Ticket #4855 (closed bug: fixed)

Opened 2 years ago

Last modified 2 years ago

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 Difficulty:
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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

Change History

Changed 2 years ago by PHO

  • cc pho@… added

Changed 2 years ago by igloo

  • milestone set to 7.2.1

Thanks for the report.

Changed 2 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.

Changed 2 years ago by claudiusmaximus

  • cc claudiusmaximus@… added

Changed 2 years ago by batterseapower

  • status changed from new to closed
  • resolution set to fixed

Fixed by 509f28cc93b980d30aca37008cbe66c677a0d6f6 to base.

Note: See TracTickets for help on using tickets.