ReadLine not see Cyrillic
Blitz3D Forums/Blitz3D Beginners Area/ReadLine not see Cyrillic
| ||
Hello. Sorry for the awful English. At me such problem: The program when reading a file * .ini does not see Russian text. Help please solve my problem. Function GetINISectionLocation%(file$, section$) Local Temp% Local f% = ReadFile(file) section = Lower(section) Local n%=0 While Not Eof(f) Local strtemp$ = ReadLine(f) n=n+1 If Left(strtemp,1) = "[" Then strtemp$ = Lower(strtemp) Temp = Instr(strtemp, section) If Temp>0 Then If Mid(strtemp, Temp-1, 1)="[" Or Mid(strtemp, Temp-1, 1)="|"Then CloseFile f Return n EndIf EndIf EndIf Wend CloseFile f End Function |
| ||
as i dont have any cyrilic text here to play with, i would suggest you, to first make a test. Write a new program, where you will first, print the text, in the cyrylic, on the screen, then write the same text, with writeline to a file. close file, open it for read, and then read that same text, and print it again to the screen. if this doesnt work then try loading a font, which can display the cyrilic chars, and see if the test from above does work. This simple test may take a bit to write, but you will know if the readline can read it or not. Maybe you could upload a sample, with the cyrilic text ? edit: or try debugging the function above with with debugger: Local strtemp$ = ReadLine(f) debuglog strtemp$ stop or without debugger: Local strtemp$ = ReadLine(f) Print strtemp$ print "press key" waitKey() |
| ||
Thank you for your response. But the code is not mine - http://www.scpcbgame.com/. I decided to Russify game. All has translated, but the text is displayed in * .ini cut or nehvataet letters is dependent on the encoding: achievementstrings.ini [s0] string1=Биологическая опасность image=Achv008 AchvDesc=Дoстичь камеры содержания SCP-008 1) UNICODE (UTF-8) ![]() 2) ANSI (windows-1251) ![]() But if you add text to the beginning of any character (example: `) I use Replace $ (string1," `", "") achievementstrings.ini [s0] string1=`Биологическая опасность` image=Achv008 AchvDesc=`Дoстичь камеры содержания SCP-008` ![]() That problem is solved, but if you want to find a text in [Text|Text], the command useless. SCP-294.ini [Арбуз|Кефир] color=255,255,255 alpha=0.5 blur=5 dispensesound=SFX\294\dispense1.ogg sound=SFX\294\cough.ogg message=Тут пусто Runtime Error Parameter must be greater than 0 If Mid(strtemp, Temp-1, 1)="[" Or Mid(strtemp, Temp-1, 1)="|"Then |
| ||
runtime error should not happen,because of the previous line:If Temp>0 Then with low information, i can only guess what is happening. im using crimson editor, and copy and pasted following lines into it: [s0] string1=`Биологическая опасность` image=Achv008 AchvDesc=`Дoстичь камеры содержания SCP-008` [Арбуз|Кефир] color=255,255,255 alpha=0.5 blur=5 dispensesound=SFX\294\dispense1.ogg sound=SFX\294\cough.ogg message=Тут пусто and saved it. The text appears with non cyrilic chars, to make them appear i have set the font as follow: arial, regular, 12 and changed the script to cyrilic. that made the cyrilic chars visibile. next, in CE, under Document\Encoding type i have set it to Ascii. - the cyrilic chars were still visibile. And again saved it. now, to test the function i have used following code: Print GetINISectionLocation("r:\test.txt","Арбуз|Кефир") WaitKey() Function GetINISectionLocation%(file$, section$) Local Temp% Local f% = ReadFile(file) section = Lower(section) Local n%=0 While Not Eof(f) Local strtemp$ = ReadLine(f) n=n+1 If Left(strtemp,1) = "[" Then strtemp$ = Lower(strtemp) Temp = Instr(strtemp, section) If Temp>0 Then If Mid(strtemp, Temp-1, 1)="[" Or Mid(strtemp, Temp-1, 1)="|"Then CloseFile f Return n EndIf EndIf EndIf Wend CloseFile f End Function and the result printed was 6, which is the line number,in which the searched text appears. i guess, that file needs to be in the ascii format, so that the readline command returns the exact string. I suggest to use an hex editor, to check the format in which the data is saved. Like this Freeware editor,HxD |
| ||
Did how do you wrotePrint GetINISectionLocation("r:\test.txt","Арбуз|Кефир") WaitKey() Function GetINISectionLocation%(file$, section$) Local Temp% Local f% = ReadFile(file) section = Lower(section) Local n%=0 While Not Eof(f) Local strtemp$ = ReadLine(f) n=n+1 If Left(strtemp,1) = "[" Then strtemp$ = Lower(strtemp) Temp = Instr(strtemp, section) If Temp>0 Then If Mid(strtemp, Temp-1, 1)="[" Or Mid(strtemp, Temp-1, 1)="|"Then CloseFile f Return n EndIf EndIf EndIf Wend CloseFile f End Function Everything works fine. But in a game nothing has changed. All the same. I here have laid out a file Download |
| ||
Your download link is giving following error: Error This document is available only to its owner. if you can, use the www.tinyupload.com. Can you describe what you are trying to do with blitzbasic and this game ? i mean, the game has this ini files, which are translated to Russian. But the game is not displaying the text completely, or ? or not correctly ? so what does blitzbasic and the functions have to do with it ? more information from your side would be helpfull. im downloading the game atm and ill try to look further in it. |
| ||
Translated all. But the lines in the file Data\SCP-294.ini and Data\achievementstrings.ini display without the initial letters or incompletely Source code: https://mega.nz/#!7Ug3XAyC!zvmbnPnpkSdJi45yzY-czYoroNvtk-exHqdKkTzudXI |
| ||
achievementstrings.ini [s0] string1=Биологическая опасность image=Achv008 AchvDesc=Дoстичь камеры содержания SCP-008 ![]() SCP-294.ini [Арбуз|Кефир] color=0,0,0 alpha=0.0 refusemessage=There is nothing to drink in the cup. dispensesound=SFX\294\dispense0.ogg ![]() ![]() ![]() |
| ||
The file (on your mega link) is unavailable. |
| ||
Fixed Source code: https://mega.nz/#!7Ug3XAyC!zvmbnPnpkSdJi45yzY-czYoroNvtk-exHqdKkTzudXI |
| ||
The sourcecode is not running here, the game gives me Runtime error, Mav, because of some setbuffer_ troubles ... |
| ||
Сopy the in a directory Blitz3D userlibs -> C:\Program Files (x86)\Blitz3D SCP - Containment Breach Run Main.bb through Blitz3D |
| ||
In Game using F3 open the console commands. In the console input room2cafeteria to teleport to a SCP-294. |
| ||
The userlibs are copied allready. The Error comes from something else. Both source code, from your url, and the Game source from the http://www.scpcbgame.com/ do not work. They give all the same error. I can compile it, the error comes after the compiled game is started. |
| ||
Strangely? My normally run ![]() |
| ||
This is pretty awesome. |
| ||
I checked. With the new version does not work Blits3D. Only version 1.99 |
| ||
Not so. I'm using V1.106 and all good on Win 10 x64 BTW. But I do have FastExt Retail V1.17 installed, dunno if matters. Above Blitz3D V1.106 there are some issues with FastExtension I believe.. So there's probably where the problem is. |
| ||
iv downloaded the 1.106 and installed. Now the game works. It must be some incompatibility between the fast extensions, and the later versions of blitz. Anyway, how much of the Game have you translated yet ? And have you found the sollution to that error, yet ? Great game,btw. |
| ||
I found a problem. Trim$() and Lower$() does not work with Russian text. |
| ||
ok, well, both function can be rewritten to act like they work with them. or, using fonts which have cyrilic chars instead of normal chars. |
| ||
i was just browsing the Code arcive, and found this |