Gamestudio Links
Zorro Links
Newest Posts
FXCM demo test failed
by qin. 01/13/26 13:53
Camera always moves upwards?
by NeoDumont. 01/12/26 09:39
Alpaca Plugin v1.5.2 Release
by kzhao. 01/11/26 13:42
Alpaca Plugin v1.4.0
by kzhao. 01/11/26 13:38
separating groups of 3 digits by a comma
by joe_kane. 01/11/26 00:01
MRC.c and WFO
by joe_kane. 01/10/26 23:58
BarOffset (default = 940 for daily bars?
by joe_kane. 01/10/26 23:46
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (Quad), 6,361 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
promfast, joe_kane, Namitha_NN, Syndrela, agasior
19190 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
String delimiter and UTF-8 Conflict #259877
04/08/09 03:28
04/08/09 03:28
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
hello:
This can be a mis understanding but ..

from the manual...im using file_str_readto.
and :delimiter - STRING* or char*, used as end mark for the text, or NULL for no end mark.

So if i use null, there is no delimiter string, and i should get the full file load, (4000 chars max.. ok...)
STRING* rss_down="#400"
var filehandle_n;
filehandle_n=file_open_read ("rss_1.txt");
file_str_readto(filehandle_n,rss_down,NULL,4000);
file_close(filehandle_n);
error(rss_down); ->> check the output

the string contains only 1 word, after a space there is another word , but those are not shown , only the first.

replacing the delimiter for:
file_str_readto(filehandle_n,rss_down,"|",4000);

Does work. but .. i read NULL had no end mark , thus no limit to end?

Is this a missing detail? or i did something wrong?


---> last news:

in fact , with some time of studding this weird behavior... i found why that happen...

well,if the text is this:

Hello world , it will read, hello world if, the delimiter is set to null. (no end mark)

If the text is:
</tag> <rss version> : please note that i did a space between the tag and rss version, and in this case this 2 words output well and it works , and the string read matches.

But when i do without space: like this:

</tag><rss version> guess what is read? Answer: only </tag> the rest , that actually is part of the same word, since there is no space is missing...

So this is a bug somewhere....
it seams that this letters <>< can't be together this is what i call.. the fish bug, note the simbol.. <>< it looks a fish to me! ehhe.. and if the text contains <>< the tail is lost.

but this happens in a special condition...

Last edited by MMike; 04/08/09 05:07.
Re: string delimiter [Re: MMike] #259878
04/08/09 03:55
04/08/09 03:55
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
this is the condition.. that i dont understand there must be some unix code or something hidden... i got this from a HTML CODE.
And its kind a funny..
So: try this 2.
Copy and past the bellow text into the .txt file that is loaded using the NULL delimiter! then on the txt file, select the fish tail (second"<" and cut the space between them with the backspace key so it will look a fish <>< then try to read.. and you will the read on the error output "<><" will become this "<>" only...

but if you erase everything and type by your own, <>< it will work.. but copy pasting this code of text wont.. which is weird.


this is the "magical" text you can copy and paste on a txt file:

<>

<



--> this looks like UNICODE UTF-8 Incompatible with GS... Which is bad:(

Last edited by MMike; 04/08/09 05:10.
Re: string delimiter [Re: MMike] #259879
04/08/09 04:00
04/08/09 04:00
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
so for loading txt files with a html file, where you extracted from a URL, you need to USE the delimiter not NULL but "|" , since "|" its very rare to appear.


you can try this with the GS page for example...

Right click right now! on mozzila or other internet explorer, go to the view HTML source, save to txt file, UTF-8 (default for HTTP and web, or EMAIL communications), and let just the 3 lines just that.. and now past into the txt file, and try to read.. and you will notice only the first tag <bla bla> will appear.. there is a hidden character somewhere or some sort..

Last edited by MMike; 04/08/09 05:12.
Re: string delimiter [Re: MMike] #259880
04/08/09 04:05
04/08/09 04:05
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I dont quite get you need.

But IF you are just trying to read the ENTIRE file, try (tested)
Code:
var filehandle_n;
filehandle_n=file_open_read ("rss_1.txt"); 
file_str_readto(filehandle_n,rss_down,"",4000);
file_close(filehandle_n);

I think using NULL in file_str_readto just means
"use the normal delimiters and delimit_str".


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: string delimiter [Re: MMike] #259882
04/08/09 04:22
04/08/09 04:22
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
ANd im also getting errors with stupid unecessary things..

i have the file, that is encoded in UTF-8 or big endiens, or the unicode.. and the file has nothing on it, and the error outputs, weird simbols, and it wont recognize this : árvore and other words similar that use ^ ~ ´ ` acents...

Can Gs be able to read and decode UNICODE and UTF-8 properly? and not only AScii? because ...
im downloading html with a plugin and when i say to save the url to a xx.txt file, dont know why but it saves with UTF-8 coding. and then when i import that using Gs there is .. those little/big word simblos messing up the text..


from wikipedia:
Quote:
Byte-order mark

Many Windows programs (including Windows Notepad) add the bytes 0xEF,0xBB,0xBF at the start of any document saved as UTF-8. This is the UTF-8 encoding of the Unicode byte-order mark. This causes interoperability problems with software that does not expect the BOM. In particular:

* It removes the desirable feature that UTF-8 is identical to ASCII for ASCII-only text. For instance a text editor that does not recognize UTF-8 will display "" at the start of the document, even if the UTF-8 contains only ASCII and would otherwise display correctly. It is for example possible to introduce Unicode into an existing computer language and compiler by adding some API for input/output, and use an external UTF-8 text editor when editing text strings. However such a compiler would not accept the BOM, which must be removed manually.
* Programs that identify file types by special leading characters will fail to identify the UTF-8 files, even for file types that can otherwise contain UTF-8. A notable example is the Unix shebang syntax.

Some Windows software (including Notepad) will sometimes misidentify UTF-8 (and thus plain ASCII) documents as UTF-16LE if this BOM is missing, a bug commonly known as "Bush hid the facts" after a particular phrase that can trigger it.


Quote:
"" at the start of the document
which is exaclty what im recieving.. on the error message, even with no text..

Last edited by MMike; 04/08/09 04:46.
Re: string delimiter [Re: MMike] #259885
04/08/09 05:07
04/08/09 05:07
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
I read also on wikipedia , there is a windows api to inter convert characters

Quote:
# iconv—a standardized API used to convert between different character encodings


Re: string delimiter [Re: EvilSOB] #259886
04/08/09 05:13
04/08/09 05:13
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
Originally Posted By: EvilSOB
I dont quite get you need.

But IF you are just trying to read the ENTIRE file, try (tested)
Code:
var filehandle_n;
filehandle_n=file_open_read ("rss_1.txt"); 
file_str_readto(filehandle_n,rss_down,"",4000);
file_close(filehandle_n);

I think using NULL in file_str_readto just means
"use the normal delimiters and delimit_str".


hey, no its not NULL is NO delimiter.. i tryed my selft tons of ways and times.


Off-topic, i need to sleep its 6:14 AM jesus.

Last edited by MMike; 04/08/09 05:14.
Re: string delimiter [Re: MMike] #259890
04/08/09 06:23
04/08/09 06:23
Joined: Jul 2000
Posts: 28,051
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,051
Frankfurt
Long thread, short answer: Yes, when no delimiter is given, the default delimiter is used. Give "" when you want to read to the end of file. I'll change that so that NULL also reads to the end of file. UTF-8 is a web site coding and has nothing to do with text reading.


Re: string delimiter [Re: jcl] #259958
04/08/09 11:30
04/08/09 11:30
Joined: Jul 2004
Posts: 1,710
MMike Offline OP
Serious User
MMike  Offline OP
Serious User

Joined: Jul 2004
Posts: 1,710
Jcl! sorry for the thread. But my file has nothing on it.. And engine is returning Simbols? i want it to convert the Reading from UTF-8 to ascii, becausse it can't Read words like this genética árvore acção .. understand me ? this is not right... That happens because the txt file that file-open-read is trying to read is not on ascii but utf-8 or something?

have you got any idea, how can i make it read text on a txt file that is encoded in utf-8 ?

would be nice to hear.

Last edited by MMike; 04/08/09 11:36.
Re: string delimiter [Re: MMike] #259965
04/08/09 11:51
04/08/09 11:51
Joined: Jul 2000
Posts: 28,051
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,051
Frankfurt
I guess the problem is some misunderstanding. The engine just reads your file, byte-wise. It does not convert UTF-8 or whatever coding you are using. You must do code conversion yourself. For this, build up a conversion table and a target font that contains the desired characters.


Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1