Hi, I saw here a post id=574513 where is described some routine that is possible to transfer any utf-8 coded text into ANSI, good for VFP6 but it doesn't work for me.
I know how to solve it with VFP9
but I have some old app I wrote in VFP6 and now desperately need some routine that will read utf-8 coded contents and show it properly in VFP6 as ANSI (Win1250). Also, I tried this code:
Any help would be appreciated. Thanks.
There is no good nor evil, just decisions and consequences.
I know how to solve it with VFP9
Code:
twobytstr=STRCONV(c_utf8, 11) &&convert
Code:
file0= FILETOSTR("utf8code.txt")
*call f
utf8encode(file0)
*
function utf8encode( lcString )
local lcUtf, i
lcUtf = ""
for i = 1 to len(lcString)
c = asc(substr(lcString,i,1))
if c < 128
lcUtf = lcUtf+chr(c)
else
lcUtf = lcUtf+chr(bitor(192,bitrshift(c,6)))+chr(bitor(128,bitand(c,63)))
endif
next
? lcUtf
return lcUtf
There is no good nor evil, just decisions and consequences.