UTF8 and EDoc

Ngoc Dao ngocdaothanh@REDACTED
Wed Sep 30 10:02:29 CEST 2009



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':
** exception exit: error
    in function  edoc_lib:run_plugin/5
    in call from lists:foreach/2

And the doc is not generated.


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]),

Could someone who takes care of EDoc look into the problem?

Thank you,

More information about the erlang-questions mailing list