Problems with Japanese and Korean

socialnetis

Active Member
Licensed User
Longtime User
Hi, I have two files, one in Japanese an another one in Korean. They were created in Notepad and saved with UTF-8 encoding. They have a Map structure, so I can read them with File.LoadMap.
The problem is that once loaded, I can't display the strings into labels, they are like null.

I attach a little example with an english and a japanese file
 

Attachments

  • Japanese.zip
    7.5 KB · Views: 238

Erel

B4X founder
Staff member
Licensed User
Longtime User
File.ReadMap / WriteMap are based on Java Properties object. This object always use ISO 8859-1 encoding.

You can instead use this code:
B4X:
Sub ReadSimpleMap(Dir As String, FileName As String) As Map
   Dim m As Map
   m.Initialize
   For Each line As String In File.ReadList(Dir, FileName)
      Dim s() As String = Regex.Split("=", line)
      m.Put(s(0), s(1))
   Next
   Return m
End Sub

There are two assumptions:
- Values don't contain '='.
- Values are single line.
 
Upvote 0
Top