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.

Author
Message
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 30th Jul 2017 21:06 Edited at: 30th Jul 2017 21:08
Please try this code and you'll see the strange text output...



Don't forget to download the Text.txt file

Attachments

Login to view attachments
Coilwinder
11
Years of Service
User Offline
Joined: 28th Feb 2013
Location: Norway
Posted: 31st Jul 2017 07:36 Edited at: 31st Jul 2017 07:36
I tried your code. It seems to display about every other line correct, and the rest garbled (But I can't really read cyrillic/russion). If I remove a comma or a space after a comma some places in the text, it affects the result (sometimes displaying more text correct or wrong), so it does seems to be a bug in there somewhere.
Apologies for any typos and strange grammar.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 31st Jul 2017 12:14
No. ReadString is not intended for reading plain text files. It is for reading null-terminated strings... i.e. if you create a file using "writestring", you can then read those strings using readstring. To read plain text, try using readline instead. It is in the documentation.


Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 31st Jul 2017 14:07
CJB, try ReadLine. Same bug.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 1st Aug 2017 16:39
Hey,

I've tried a few things with this.
I change the encoding of the text file to UTF-8 with a BOM, UTF-8 without a BOM, UTF-16 with and without a BOM, Big Endien, Little Endien & Unicode ASCII Escaped.
I tried changing the line endings to DOS, UNIX and MAC terminators.
And I tried all of those things simply reading the file and displaying it, then reading it, writing it, reading the newly written file and displaying it again.

Each time I got a slightly different result but it was never perfect!

There's nothing further I can try so I think I may have to concur with you, this is a bug.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 1st Aug 2017 20:32 Edited at: 8th Aug 2017 06:58
paul fixed it
AGK (Steam) V2017.07.19 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)

Attachments

Login to view attachments
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 5th Aug 2017 11:26
I hope Paul will see this and fix. I'm stuck with the new game...
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Aug 2017 23:18
Thanks, fixed for the next version. It was caused by the way AppGameKit reads files, it currently reads them in blocks of 256 bytes, and if a UTF-8 character happened to get split across one of those boundaries it would no longer look like valid UTF-8. In this case AppGameKit assumes the 256 bytes it read are extended ASCII and tries to convert them (incorrectly) into UTF-8 causing all sorts of problems. The new version will read the entire string before checking if it is UTF-8 encoded.

Login to post a reply

Server time is: 2024-09-30 05:22:11
Your offset time is: 2024-09-30 05:22:11