Issue with xpathsnippet no support for German „Umlaute” like äöäÖÄÖ H

Issue with xpathsnippet no support for German „Umlaute” like äöäÖÄÖ

Hi.
If a got a XML like this:

?xml version=""1.0"" encoding=""UTF-8""?>
<Values>
<Value>
<Address>Bäckstreet 0</Address>
</Value>
<Value>
<Address>Backstreet 1</Address>
</Value>
</Values>

And use
xpathsnippet(MY_XML_LIKE_ABOVE "/Values/Value/Address/text()")

Evaluating with xpathsnipped fails with :
“The rule contains an expression that cannot be tested”

If I remove the “ä” everything goes well.
Any ideas ?
Many thans in advance
...

OriginalPostID-105295

OriginalPostID-105295

  Discussion posts and replies are publicly visible

  • Your example worked fine for me after fixing the following:

    1. Added the missing opening tag in the XML declaration and removing the extra quotation marks in the 1.0 and UTF-8:

    <?xml version="1.0" encoding="UTF-8"?><Values><Value><Address>Bäckstreet 0</Address></Value><Value><Address>Backstreet 1</Address></Value></Values>

    2. And by adding a comma in the xpathsnippet when testing from the rules interface and adding the prefix ri! to MY_XML_LIKE_ABOVE:

    xpathsnippet(ri!MY_XML_LIKE_ABOVE, "/Values/Value/Address/text()")

    3. However if you keep having problems make these two changes and also switch the encoding to ISO-8859-1.

    <?xml version="1.0" encoding="ISO-8859-1"?><Values><Value><Address>Bäckstreet 0</Address></Value><Value><Address>Backstreet 1</Address></Value></Values>



  • Hi Eduardo.
    Switching to ISO-8859-1 was the solution.
    About double quotes and missing opening tag:
    I copy this from a rule that should return string as a test XML so the double quotes are necessary.-
    The opening tag was not copied into this post but was there
    However many thanks for your help.
  • I am having similar issues with languages like Chinese or Japanese. I tired to execute the above code but still I am getting it as "B?ckstreet 0, Backstreet 1". Please Assist
  • Hi sureshrk.
    The pitfall here may be that the data cannot be encoded due to special country based characters.
    So the XML encoding has to be set correctly. In this case we have German Umlaute like ÖÄÜ that can be encoded using “ISO-8859-1” .
    This is the reason why we have to replace the UTF-8 encoding at the beginning of the XML string.
    Try to replace
    ?xml version=""1.0"" encoding=""UTF-8""?>
    with
    ?xml version=""1.0"" encoding=""ISO-8859-8""?>
    Also the double "" may be a problem,
  • Hi Andreasw, I tired with ISO-8859-8 but it didn't work and I guess ISO-8859 is specific to Latin Languages. Actually I tried to replicate your sample but still I am getting "B?ckstreet 0, Backstreet 1". I am on cloud not sure if any configuration is missing.
    load
    (
    local!xml: "<?xml version=""1.0"" encoding=""ISO-8859-1""?><Values><Value><Address>Bäckstreet 0</Address></Value><Value><Address>Backstreet 1</Address></Value></Values>",
    xpathsnippet(local!xml, "/Values/Value/Address/text()")
    )
  • This is due to the fact that the server might be missing the following setting:

    -Dfile.encoding=UTF-8

    as part of the JVM arguments.