[erlang-questions] When does xmerl handles unicode_char()

Robert Raschke rtrlists@REDACTED
Tue Jun 30 10:50:52 CEST 2009


On Tue, Jun 30, 2009 at 7:09 AM, Roessner, Silvester <
silvester.roessner@REDACTED> wrote:

>
> FAILS: Second run with a single umlaut:
>
>        (czv_rx_bridge@REDACTED)16> f().
>        ok
>        (czv_rx_bridge@REDACTED)17> {ok, B} =
> file:read_file("V:/test.xml").
>        {ok,<<"<?xml version=\"1.0\" encoding=\"UTF-8\"
> standalone=\"yes\"?>\r\n<test>This is a test with umlaut ä</test>">>}
>        (czv_rx_bridge@REDACTED)18> U = unicode:characters_to_list(B).
>        "<?xml version=\"1.0\" encoding=\"UTF-8\"
> standalone=\"yes\"?>\r\n<test>This is a test with umlaut ä</test>"
>        (czv_rx_bridge@REDACTED)19> xmerl_scan:string(U).
>        3265- fatal:
> {error,{wfc_Legal_Character,{error,{bad_character,228}}}}
>        ** exception exit: {fatal,
>                               {{error,
>
>  {wfc_Legal_Character,{error,{bad_character,228}}}},
>                                {file,file_name_unknown},
>                                {line,2},
>                                {col,36}}}
>             in function  xmerl_scan:fatal/2
>             in call from xmerl_scan:scan_char_data/5
>             in call from xmerl_scan:scan_content/11
>             in call from xmerl_scan:scan_element/12
>             in call from xmerl_scan:scan_document/2
>             in call from xmerl_scan:string/2
>
>
I would expect you also have to change the XML encoding appropriately after
doing such a conversion, assuming that unicode:characters_to_list/1 produces
something other than utf8.

Robby


More information about the erlang-questions mailing list