UTF8 and EDoc
Ngoc Dao
ngocdaothanh@REDACTED
Wed Sep 30 10:02:29 CEST 2009
Greetings,
1.
When I use EDoc library in Erlang R13B02-1 to create document with
Japanese characters in the doc comments, there is error:
edoc: error in doclet 'edoc_doclet':
{'EXIT',{no_translation,[{io,put_chars,[<0.54.0>,unicode,<<60,33,68,79,67,84,89,80,...>>]},{edoc_lib,write_file,4},{edoc_doclet,source,9},{lists,foldl,3},{edoc_doclet,sources,5},{edoc_doclet,gen,6},{edoc_lib,run_plugin,5},{lists,foreach,2}]}}.
** exception exit: error
in function edoc_lib:run_plugin/5
in call from lists:foreach/2
And the doc is not generated.
2.
The cause of the problem is at io:put_chars of write_file in
edoc_lib.erl. My dirty hack:
write_file(Text, Dir, Name, Package) ->
Dir1 = filename:join([Dir | packages:split(Package)]),
File = filename:join(Dir1, Name),
ok = filelib:ensure_dir(File),
case file:open(File, [write]) of
{ok, FD} ->
%io:put_chars(FD, Text), <-- ERROR
ok = file:close(FD),
file:write_file(File, unicode:characters_to_binary(Text)); <-- HACK
{error, R} ->
R1 = file:format_error(R),
report("could not write file '~s': ~s.", [File, R1]),
exit(error)
end.
Could someone who takes care of EDoc look into the problem?
Thank you,
Ngoc
More information about the erlang-questions
mailing list