Weird Characters for xml

Hey guys
Anyone knows how to overcome this issue here?
Capture
This happens when i open an xml file.

And this is my M code

let
Source = Xml.Tables(File.Contents(“C:\Users\Pedro…\Sources\SAFT_REALAFRICA_01-01-2020_31-05-2020.xml”)),
Table1 = Source{1}[Table],
Table2 = Table1{1}[Table],
#“Changed Type” = Table.TransformColumnTypes(Table2,{{“CustomerID”, type text}, {“AccountID”, type text}, {“CustomerTaxID”, type text}, {“CompanyName”, type text}, {“SelfBillingIndicator”, Int64.Type}, {“Telephone”, type text}, {“Fax”, type text}, {“Website”, type text}})
in
#“Changed Type”

Any help would be very appreciated.
Thanks a lot
Pedro

Found a similar request here, maybe that can help you.

Thanks @Melissa!!!
And how do i change it to unicode? Can you tell me?

Do a web search “encoding of your xml file to unicode”

This looks promising…
https://www.tutorialspoint.com/xml/xml_encoding.htm

2 Likes

Hey @Melissa
Sometimes, nor only we don’t know where to look but also how. Your answer made me look for it. Thank you very much for that.
If anyone wants to know, the M code now is like this one:

let
Source = Xml.Tables(File.Contents(“C:\Users\Pedro…\Sources\SAFT_REALAFRICA_01-01-2020_31-05-2020.xml”), null, 1252),
Table1 = Source{1}[Table],
Table2 = Table1{1}[Table],
#“Changed Type” = Table.TransformColumnTypes(Table2,{{“CustomerID”, type text}, {“AccountID”, type text}, {“CustomerTaxID”, type text}, {“CompanyName”, type text}, {“SelfBillingIndicator”, Int64.Type}, {“Telephone”, type text}, {“Fax”, type text}, {“Website”, type text}})
in
#“Changed Type”

The difference is that you have to add “null, 1252” after the file name.
Thanks again @Melissa

3 Likes

Excellent!
Thanks for sharing this with the community @pedroccamara :+1:

One more thing: if you’re importing several xml files from a folder, goto to every transform sample file, one for each upload you’ve made, and then click on source and it opens a window where you can change the file origin, in my case, to 1252. See this pic beside:

No more weird characters! Gone!
Have a great weekend all of you. Stay safe and healthy
Pedro

1 Like