Opened 9 years ago

Closed 9 years ago

#4855 closed bug (fixed)

Debug.Trace.trace mangles Unicode strings

Reported by: andersk Owned by:
Priority: normal Milestone: 7.4.1
Component: libraries/base Version: 7.0.1
Keywords: Cc: pho@…, claudiusmaximus@…
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: Incorrect result at runtime Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

Prelude Debug.Trace> trace "Σὲ γνωρίζω ἀπὸ τὴν κόψη" ()
�r ����w�� 
()

Change History (5)

comment:1 Changed 9 years ago by PHO

Cc: pho@… added

comment:2 Changed 9 years ago by igloo

Milestone: 7.2.1

Thanks for the report.

comment:3 Changed 9 years ago by batterseapower

This happens because GHC call the C function debugBelch to output a "trace" string. This has the advantage that the user of GHC can override how "trace" messages are handled by changing the debugMsgFn function pointer.

If we were to simply delete the GHC-specific #ifdef in Debug.Trace we would be using "hPtStrLn stderr" instead, so the correct locale encoding would be applied and trace would handle unicode properly.

Another option is to fix #5061, at which point we can make Trace work properly by using withCString instead of withCAString.

comment:4 Changed 9 years ago by claudiusmaximus

Cc: claudiusmaximus@… added

comment:5 Changed 9 years ago by batterseapower

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.