I have a bunch of txt files saved in Unicode and I wanted to create a macro that would convert them to UTF-8. I coded the following conversion function:
But it's doing weird things. The new files are indeed in UTF-8 format but the conversion also added one space character after every character in the file. S o , I g e t s o m e t h i n g l i k e t h i s ! ! !Code:Sub Encode(ByVal myPath As String) Set objStream = CreateObject("ADODB.Stream") With objStream .Charset = "Unicode" .Open .LoadFromFile myPath .Charset = "UTF-8" .SaveToFile myPath, 2 .Close End With Set objStream = Nothing End Sub




Reply With Quote