I don't see this behavior.
Check this code for example which works as expected:
B4X:
Dim s As String
s = " 123"
Dim m As Map
m.Initialize
m.Put(s,s)
File.WriteMap(File.DirRootExternal, "1.txt", m)
Log(m)
m = File.ReadMap(File.DirRootExternal, "1.txt")
Dim s2 As String
s2 = m.Get(" 123")
Log(s2.Length)
Log(m)
Not sure if this will help, but you could use an arbitrary character at the beginning of each row and strip it out on reading. Also you would have to change the keys of the non strings to sort in the correct order if that's important. I attach an example.