Page 1 of 1

Char2UTF8() in XML

Posted: Fri Jan 12, 2024 3:27 am
by skiman
Ho,

I'm using the Char2UTF8() to add data to an XML. I need this for French characters as é è à and so on.

Now this seems to be wrong interpreted by Microsoft Edge when you open the XML.

Anyone who is using french characters in an XML? Or special characters as are used in German, Spanish, Romanian, ... Which conversion are you using?

Thanks for any help.

Re: Char2UTF8() in XML

Posted: Fri Jan 12, 2024 7:40 am
by PedroAlex
HI Chris,
It depends on what the purpose of the XML is.
I use Windows -1252 to generate the XML for the tax authority and it works well with Portuguese characters.

Re: Char2UTF8() in XML

Posted: Fri Jan 12, 2024 10:04 am
by skiman
Hi Pedro,

Thanks for the suggestion but it seems as it isn't working.

I changed the encoding and I removed the char2utf8. Now I can open the XML with Edge without a problem, but the signs as é à è aren't correctly shown.

I'm using Chilkat to create the XML. I don't know if that could be the cause of my problem.

Re: Char2UTF8() in XML

Posted: Fri Jan 12, 2024 12:23 pm
by digitsoft
You could send an example of the XML file

Re: Char2UTF8() in XML

Posted: Mon Jan 15, 2024 12:09 am
by k-insis
Make sure you are compiling exe into ANSI mode, not OEM.

As I am rather inclined into doubt of utf capability of xpp own functions, can you use ot4xb conversion function to do conversion?

But yes, provide xml in zipped format , please so we can see inside.
skiman wrote: Fri Jan 12, 2024 3:27 am Ho,

I'm using the Char2UTF8() to add data to an XML. I need this for French characters as é è à and so on.

Now this seems to be wrong interpreted by Microsoft Edge when you open the XML.

Anyone who is using french characters in an XML? Or special characters as are used in German, Spanish, Romanian, ... Which conversion are you using?

Thanks for any help.

Re: Char2UTF8() in XML

Posted: Mon Jan 15, 2024 1:47 am
by skiman
Hi,

In attachment a sample.

In de tag <deliveryaddress><street> I placed the following in my Xbase app:
street é à test
.

In my source code I have:

Code: Select all

...
oXml:newchild2("orderHeader|deliveryAddress|street",ConvCpToUtf(alltrim(cAdres)))
...
The function ConvCpToUtf is as follows:

Code: Select all

function ConvCpToUtf(cText)
***************************
if !empty(cText)
	return cOemToUtf8(cText)
endif
return ""
The result is the same when using the Xbase conversion function of the OT4XB function.

In attachment the XML file.