haskell / ghc-events

Library and tool for parsing .eventlog files from GHC
http://www.haskell.org/haskellwiki/ThreadScope
Other
33 stars 33 forks source link

Fix broken UTF-8 decoding #55

Closed maoe closed 4 years ago

maoe commented 4 years ago

This PR fixes broken UTF-8 decoding in ghc-events.

The first commit demonstrates the issue. As you can see in https://travis-ci.org/maoe/ghc-events/jobs/628026035#L665-L666, current ghc-events cannot decode unicode characters properly. This is because getString internally uses nBytes, which reads bytes as [Word8] and turns it into String using chr. In this PR getString is replaced with getTextNul and it uses text's decodeUtf8' instead.

Mikolaj commented 4 years ago

LGTM.

maoe commented 4 years ago

@Mikolaj Thanks for the quick review! I’ll merge it now.