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

Mikkel Jensen dirtyundies@REDACTED
Sun Dec 3 20:17:17 CET 2006


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



More information about the erlang-questions mailing list