Permalink
Browse files

Encode UTF-8 as UTF-8, not Unicode points

  • Loading branch information...
1 parent 56326e4 commit fb871f40bf4d4754cdd4edd858ccff683867e798 @evanmiller evanmiller committed Jan 17, 2013
Showing with 4 additions and 1 deletion.
  1. +4 −1 src/boss_compiler.erl
View
@@ -187,7 +187,10 @@ transform_char(8869) -> % ⊥
transform_char(10178) -> % ⊥ look-alike
{ok, ",'contains_none',"};
transform_char(Char) when Char > 127 ->
- {ok, lists:flatten(io_lib:format("\\x{~.16B}", [Char]))};
+ Bytes = binary_to_list(unicode:characters_to_binary([Char], unicode, utf8)),
+ {ok, lists:flatten(lists:map(fun(Byte) ->
+ io_lib:format("\\x{~.16B}", [Byte])
+ end, Bytes))};
transform_char(_) ->
error.

0 comments on commit fb871f4

Please sign in to comment.