Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Not enough function of changing file encoding in OpenToRead...

Author
Message
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 17th May 2016 11:58
By default it opens files in CP1251 encoding system, but I need it to read UTF-8...
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th May 2016 14:02
i guess you mean string/readstring should support utf8 in agk.
a file itself are just bytes.
ReadByte
CreateMemblockFromFile,GetMemblockByte
AGK (Steam) V2.0.18 : Windows 10 Pro 64 Bit : AMD (15.30.1025) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 17th May 2016 14:19 Edited at: 17th May 2016 14:19
Yes, I got an array of bytes but it is not in the UTF-8 format - it is in CP1251. So I can not find how to convert them into UTF-8...
File in text encoded in the UTF-8.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th May 2016 19:24 Edited at: 17th May 2016 19:28
no, the byte array is not cp1051, its binary 1:1 the original utf8 file.
how to decode the bytes into a multibyte sequence you can read here at wiki.
see part Description there:
https://en.wikipedia.org/wiki/UTF-8

i think a text file with a fix len unicode each char (4bytes) is better for you.
AGK (Steam) V2.0.18 : Windows 10 Pro 64 Bit : AMD (15.30.1025) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 17th May 2016 22:17
It doesn't help...
When I save my text file in UNICODE format on notepad is just adds a null terminator between the characters... Non-ASCII characters still have '-' and I don't know what to do with them...
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 18th May 2016 09:45
can you add the files as attachment here?
AGK (Steam) V2.0.18 : Windows 10 Pro 64 Bit : AMD (15.30.1025) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 18th May 2016 09:49
AGK does not support the reading of UTF8 or any Unicode files.
It is an issue that I've been mentioning and hoping will be addressed for a long time but still nothing.
AGK V2 user - Tier 1 (mostly)
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 18th May 2016 11:34
I'm making a system what will be able to support every character - you want! Chinese, japanese, arabic, cyrillic.... EVERYTHING YOU WANT!!!
Also it has a very important thing for me called "kernings"... All text will look as it must look!
It was working for Windows only, but now when the Android NDK started to support the std::wstring (full unicode string) I'm able to create a cross platform enhanced font system for AGK...
But the problem is that I'm able to read that type of files only in Windows.... but I think I found the way to make it readable for any OS...
I'll just encode all of text symbols into the INT format!!!
If some one will need this - I'll share this for you guys!
P.S. Tier2 only...

Login to post a reply

Server time is: 2024-09-29 13:22:18
Your offset time is: 2024-09-29 13:22:18