[erlang-questions] Exporting UTF-8 strings from xmerl

Bertil Karlsson <>
Mon Dec 4 12:22:13 CET 2006


It is not possible to export UTF-8 decoded characters.

/Bertil

Mikkel Jensen wrote:
> I'm trying to write a webapplication which needs to be able to accept
> and return UTF-8 encoded XML.
>
> So far I've succeeded in parsing the received XML using xmerl, but I
> can't seem to export it again.
>
> The XML content is correctly transformed into a list of unicode
> codepoints (e.x. [1488] is the "aleph" character)
> but these high integer values are not converted back when exporting,
> causing Yaws to crash :(
>
> 1> Xml = {xmlElement,doc,
>                 doc,
>           		[],
>           		{xmlNamespace,[],[]},
>           		[],
>           		1,
>           		[],
>           		[{xmlText,[{doc,1}],1,[],[1488],text}],
>           		[],
>           		"C:/",
>           		undeclared},
> xmerl:export([{xmlDecl, "1.0", "UTF-8", yes, []}, Xml], xmerl_xml).
> ["<?xml version=\"1.0\"?>",[[["<","doc",">"],[[1488]],["</","doc",">"]]]]
>
> I guess I'm missing some minor but important thing, but what???
>
> - Mikkel
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>   



More information about the erlang-questions mailing list