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 / [BUG] SetMemblockString

Author
Message
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 23rd Apr 2017 15:49
If I load a text file via CreateMemblochFromFile with German umlauts, everything works. If I load this however first in a string. Then try to fill the memblock via SetMemblockString. Is there an error message that the memblock is too small.

With this codesnippet you can see this.


I guess it's due to text encoding. These umlauts seem to be read in unicode format or so. Is only a guess.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 24th Apr 2017 03:02
Load the memblock from file then read what it's size is. That might shed some light.

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Preben
AGK Studio Developer
19
Years of Service
User Offline
Joined: 30th Jun 2004
Location:
Posted: 24th Apr 2017 08:31
The problem here is that Len return the number of chars , and not the memory needed for the string.

See memblock in screenshot using SetMemblockString:

Both commands works correct , so guess a new command is needed to get "memory needed to store string" ?

Not sure if you can always count 2 bytes if ascii >= 128 , if your going to do your own new StringMemoryUsed command





best regards Preben Eriksen,

Attachments

Login to view attachments
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 24th Apr 2017 09:52
This is exactly what I have found. Have it checked also with the hex editor.
What also confirms my first guess (I think? :-| ).
It's also with other char's that lie above the 127 mark. (²³ · ect.).
But I do not like a workaround of this problem.
So the suggestion is maybe a command like this.
size(String)
Or a good string encoding to ASCII, UTF-8 or so.
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 26th Apr 2017 14:06
Thanks, I've added the command ByteLen to the next version to return the length of a string in bytes.
MadBit
VIP Member
Gold Codemaster
14
Years of Service
User Offline
Joined: 25th Jun 2009
Location: Germany
Posted: 26th Apr 2017 17:20
Thanks Paul
Share your knowledge. It\'s a way to achieve immortality. (Tenzin Gyatso)
Pixie-Particle-Engine

Login to post a reply

Server time is: 2024-04-25 07:06:20
Your offset time is: 2024-04-25 07:06:20