Problems saving XML file with special character in the database (ç, ã, etc)

0

My problem is this: I'm issuing an electronic correction letter in C # and at the time of saving the XML of the event returned by SEFAZ, even though all the characters in the file are normal, when saving in the database as blob they get like this, with these strange characters ("xE7, xE3") when I export the file:

Does anyone have any idea how to solve this?

Edit1: And when I try to give load in this xml with these strange characters it throws XmlException complaining of invalid character

    
asked by anonymous 20.02.2017 / 13:18

2 answers

1

I solved the problem by doing an Encoding.Convert from latin1 to utf-8 before giving WriteAllBytes, then it came right and did not give more error when giving Load per invalid character.

    
20.02.2017 / 15:23
0

If you are using NotePad ++, go to the Coding menu and change from UTF-8 to ANSI, it will not solve your problem, but it will show you the result with the correct characters.

Check the files of your system, it is incompatible between your project and the data you receive, one with ANSI (probably yours) and the other as UTF-8

    
20.02.2017 / 14:43