Function SaveTextToFile(FileFullPath As String, _ sText As String, Optional Overwrite As Boolean = False) As _ BooleanOn Error GoTo ErrorHandlerDim iFileNumber As IntegeriFileNumber = FreeFileIf Overwrite Then Open FileFullPath For Output As #iFileNumberElse Open FileFullPath For Append As #iFileNumberEnd IfPrint #iFileNumber, sTextSaveTextToFile = TrueErrorHandler:Close #iFileNumberEnd Function
The above function saves the String contained in the variable sText in the File given in the variable FileFullPath.
My problem is that my String contains also characters in other languages and I want to save it in a file with the extension .xml so it opens in Excel.
In the attached .zip file there are 2 files. "book1.xml" and "book2.xml".
book1.xml can be opened in an XML editor
book2.xml has been made using the aforementioned function and can not be opened in an XML editor since there is an encoding error
book1.xml is correct UTF-8
book2.xml made using the aforementioned function is defnitely saved as a one byte encoded file, and hex C5 et al. are illegal UTF-8, I am not sure it is ANSI, but it is a single byte encoding
Is it possible to make some modifications so the above mentioned function saves the multi-language string as an .xml UTF-8 (2 byte) file so it is compatible with other languages and opens with Excel or .xml editors?
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
-Mike Kapnisakis, Warner Bros
With your subscription - you'll gain access to our exclusive IT community of thousands of IT pros. You'll also be able to connect with highly specified Experts to get personalized solutions to your troubleshooting & research questions. It’s like crowd-sourced consulting.
We can't always guarantee that the perfect solution to your specific problem will be waiting for you. If you ask your own question - our Certified Experts will team up with you to help you get the answers you need.
Our certified Experts are CTOs, CISOs, and Technical Architects who answer questions, write articles, and produce videos on Experts Exchange. 99% of them have full time tech jobs - they volunteer their time to help other people in the technology industry learn and succeed.
We can't guarantee quick solutions - Experts Exchange isn't a help desk. We're a community of IT professionals committed to sharing knowledge. Our experts volunteer their time to help other people in the technology industry learn and succeed.