My app reads a text file, line by line, which contains the special character ú (in "Dún Laoghaire", a province in Ireland). I use Notepad++ to edit and save the text file with either ANSI or UTF8 encoding, and both encoding yield same result.
After the following line of code is executed, the ú has been changed to "?" with solid background.
code to read text file:
Dim text As List = File.ReadList(File.DirAssets,fileName)
The problem: the text file wasn't really saved with UTF8 encoding even though I selected UTF8 from encoding dropdown menu and Saved the file.
MY Solution: Use Notepad instead of Notepad++ for this purpose, select File, Save As, and specify UTF8 encoding, if not selected yet, then finally hit Save.
Dim bytes() As Byte = File.ReadBytes(File.DirAssets,fileName)
Dim fulltext As String = BytesToString(bytes,0,bytes.Length,"UTF-8")
Dim lines() As String
lines = Regex.Split(CRLF, fulltext)
Can you upload the file from your assets? Sure it is saved as UTF-8?
The problem: the text file wasn't really saved with UTF8 encoding even though I selected UTF8 from encoding dropdown menu and Saved the file.
MY Solution: Use Notepad instead of Notepad++ for this purpose, select File, Save As, and specify UTF8 encoding, if not selected yet, then finally hit Save.