Author Topic: Russian language in QB64  (Read 6506 times)

0 Members and 1 Guest are viewing this topic.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Russian language in QB64
« Reply #15 on: September 26, 2021, 02:26:29 pm »
@kservice you can use the geany IDE https://www.geany.org/ but you must be aware that geany is a multi-programming-language IDE that determines what compiler to launch depending on the file extension, for a *.bas file it will try to launch FreeBASIC also the highlighting is that of FB
you can write a small batch file that will launch qb64 and compile your program, substitute the fbc command with the name of your bat file
you must have a .bas file open in geany to adjust the menu settings for basic files because the menu settings vary depending on what kind of document is open, once you have a bas file open click on the Build->Set Build Commands in the Compile box you will see something like
fbc  -w all "%f"
you could replace fbc with a batch file that will launch qb64 and compile your program, but for simplicity try
full-path-to-qb64 -x "%f"
last time I tried it, it would not highlight the lines containing errors, don't remember if it even would report the error line, that's why it would be good for you to write a batch file that will catch an error if there is one, if your program compiles successfully then you can click on the run button
also for non-ASCII language you probably need to make sure to BOM your document, click on Document->Write Unicode BOM

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Russian language in QB64
« Reply #16 on: September 26, 2021, 02:42:01 pm »
good news, it does report the error line number but it does not highlight the line

Offline kservice

  • Newbie
  • Posts: 25
    • View Profile
Re: Russian language in QB64
« Reply #17 on: September 26, 2021, 04:05:32 pm »
For other QB64 programming questions, yes, best to start a new topic in a new thread (post).

I would gladly closed the topic and moved to solving other issues. But still early. It turns out that to achieve the correct reproduction of Cyrillic in QB64 IDE is still half. After compiling and running a program to execute on the screen, instead of Cyrillic garbage. How do I understand it is irresistible?
  [ You are not allowed to view this attachment ]  

May be I Can  apply any other compiler?
« Last Edit: September 26, 2021, 04:10:39 pm by kservice »

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Russian language in QB64
« Reply #18 on: September 26, 2021, 04:38:57 pm »
I just tried this with QB64
Code: QB64: [Select]
  1. Print "Статья 1 Все люди рождаются свободными и равными в своем достоинстве и правах."
  2. Print "Они наделены разумом и совестью и должны поступать в отношении друг друга в духе"
  3. Print "братства."
  4. Print "Статья 2 Каждый человек должен обладать всеми правами и всеми свободами, провоз-"
  5. Print "глашенными настоящей Декларацией, без какого бы то ни было различия, как-то в от-"
  6. Print "ношении расы, цвета кожи, пола, языка, религии, политических или иных убеждений,"
  7. Print "национального или социального происхождения, имущественного, сословного или"
  8. Print "иного положения. Кроме того, не должно проводиться никакого различия на основе по-"
  9. Print "литического, правового или международного статуса страны или территории, к кото-"
  10. Print "рой человек принадлежит, независимо от того, является ли эта территория независи-"
  11. Print "мой, подопечной, несамоуправляющейся или как-либо иначе ограниченной в своем су-"
  12. Print "веренитете."
  13.  
and the output is garbage, then I tried this
Code: QB64: [Select]
  1.  
  2. Print "Статья 1 Все люди рождаются свободными и равными в своем достоинстве и правах."
  3. Print "Они наделены разумом и совестью и должны поступать в отношении друг друга в духе"
  4. Print "братства."
  5. Print "Статья 2 Каждый человек должен обладать всеми правами и всеми свободами, провоз-"
  6. Print "глашенными настоящей Декларацией, без какого бы то ни было различия, как-то в от-"
  7. Print "ношении расы, цвета кожи, пола, языка, религии, политических или иных убеждений,"
  8. Print "национального или социального происхождения, имущественного, сословного или"
  9. Print "иного положения. Кроме того, не должно проводиться никакого различия на основе по-"
  10. Print "литического, правового или международного статуса страны или территории, к кото-"
  11. Print "рой человек принадлежит, независимо от того, является ли эта территория независи-"
  12. Print "мой, подопечной, несамоуправляющейся или как-либо иначе ограниченной в своем су-"
  13. Print "веренитете."
  14.  
the output is garbage
one problem is that QB64 won't compile a file with a Unicode BOM
the first snippet saved with a BOM and compiled with FreeBASIC prints perfectly on the console  [ You are not allowed to view this attachment ]  [/code]
« Last Edit: September 26, 2021, 04:58:12 pm by jack »

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Russian language in QB64
« Reply #19 on: September 26, 2021, 04:52:47 pm »
Code: [Select]
text changed after edit
with an extra
the Cyrillic text shows on the forum
« Last Edit: September 26, 2021, 04:59:26 pm by jack »

FellippeHeitor

  • Guest
Re: Russian language in QB64
« Reply #20 on: September 26, 2021, 05:37:02 pm »
You've configured the IDE setting a font that supports the character set you wish to use and by setting the proper code page. You need to do the same if you want to output text in Russian in your program. The example below comes from the wiki page for _MapUnicode. Take it and adapt it as required.

Code: QB64: [Select]
  1. _FONT _LOADFONT("C:\windows\fonts\cour.ttf", 20, "MONOSPACE")
  2.  
  3. RESTORE Microsoft_pc_cpMIK
  4. FOR ASCIIcode = 128 TO 255
  5.   READ unicode
  6.   _MAPUNICODE Unicode TO ASCIIcode
  7.  
  8.  
  9. FOR i = 128 TO 255
  10.   PRINT CHR$(i) + " ";
  11.   cnt = cnt + 1
  12.   IF cnt MOD 16 = 0 THEN PRINT
  13.  
  14. Microsoft_pc_cpMIK:
  15. DATA 1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055
  16. DATA 1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071
  17. DATA 1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087
  18. DATA 1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103
  19. DATA 9492,9524,9516,9500,9472,9532,9571,9553,9562,9566,9577,9574,9568,9552,9580,9488
  20. DATA 9617,9618,9619,9474,9508,8470,167,9559,9565,9496,9484,9608,9604,9612,9616,9600
  21. DATA 945,223,915,960,931,963,181,964,934,920,937,948,8734,966,949,8745
  22. DATA 8801,177,8805,8804,8992,8993,247,8776,176,8729,183,8730,8319,178,9632,160  

http://www.qb64.org/wiki/MAPUNICODE
http://www.qb64.org/wiki/Code_Pages
http://www.qb64.org/wiki/LOADFONT
http://www.qb64.org/wiki/FONT

Offline kservice

  • Newbie
  • Posts: 25
    • View Profile
Re: Russian language in QB64
« Reply #21 on: September 26, 2021, 05:46:29 pm »
I have already read all this, but I did not understand how to apply it in my situation. Tell me, please, how to adapt?
1. What data should I substitute in DATA?
2. Why values of symbol codes in the example do not coincide with the values that I see, for example, on en.wikipedia.org?
3. What kind of number system shows codes in the DATA field  (OCT, HEX, DEC .....?
« Last Edit: September 26, 2021, 06:25:31 pm by kservice »