Hi, glad it help. I solved this in the past too, for Czech. What you suggest is certainly possible, but you will have to watch the unicode page that you set before printing the text to the screen.
I am adding a program that shows how you can use multiple code pages at once. That is why the text in French is intentionally printed "wrong" this time - with the American MS-DOS code page and then the code page is thrown back to 1252 so that it supports French. Interesting question, this is my first time doing this.
While writing the program I found that it is necessary to use a graphics screen to be able to display different types of encoding. If you use Screen 0, only the first type (1252) is set and then it does not change. I assume that this is intentional, because the text screen 0 can only hold 256 characters, while the graphics screen approaches the image differently and will draw anything.
The numbers for the DATA blocks are obtained from the help: In the IDE, press Shift+F1 together, click on Kws_Alphab, then write: "Mapunicode" click on _MapUnicode (statement), scroll down in the help window and click on Code Pages there. That will lead you to the supported encoding types. Maybe someone will add a link directly to the QB64PE wiki here?
I am adding a program that shows how you can use multiple code pages at once. That is why the text in French is intentionally printed "wrong" this time - with the American MS-DOS code page and then the code page is thrown back to 1252 so that it supports French. Interesting question, this is my first time doing this.
While writing the program I found that it is necessary to use a graphics screen to be able to display different types of encoding. If you use Screen 0, only the first type (1252) is set and then it does not change. I assume that this is intentional, because the text screen 0 can only hold 256 characters, while the graphics screen approaches the image differently and will draw anything.
The numbers for the DATA blocks are obtained from the help: In the IDE, press Shift+F1 together, click on Kws_Alphab, then write: "Mapunicode" click on _MapUnicode (statement), scroll down in the help window and click on Code Pages there. That will lead you to the supported encoding types. Maybe someone will add a link directly to the QB64PE wiki here?
Code: (Select All)
Screen _NewImage(1024, 768, 256)
_Font _LoadFont("C:\windows\fonts\cour.ttf", 20, "MONOSPACE")
SetUnicode 1252
'Text$ = "Il s'agit d'un test de texte en français."
Text$ = "Il s'agit d'un test de texte en français. ÜÝŢßŰ ÜŰ"
Print Text$
SetUnicode 437 'in this case is text printed bad
Print Text$
SetUnicode 1252
file$ = "DÉPOSER"
ff = FreeFile
Open file$ For Binary As ff
Close ff
If _FileExists(file$) Then Print "Fichier avec nom français créé": Kill file$ Else Print "Fichier avec nom français non créé"
End
Sub SetUnicode (CodePage As Integer)
Select Case CodePage
Case 1252
Restore Microsoft_windows_cp1252:
For ASCIIcode = 128 To 255
Read unicode
_MapUnicode unicode To ASCIIcode
Next
Microsoft_windows_cp1252:
Data 8364,0,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,0,381,0
Data 0,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,0,382,376
Data 160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175
Data 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191
Data 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207
Data 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223
Data 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239
Data 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
Case 437
Restore Microsoft_pc_cp437
For ASCIIcode = 128 To 255
Read unicode
_MapUnicode unicode To ASCIIcode
Next
Microsoft_pc_cp437:
Data 199,252,233,226,228,224,229,231,234,235,232,239,238,236,196,197
Data 201,230,198,244,246,242,251,249,255,214,220,162,163,165,8359,402
Data 225,237,243,250,241,209,170,186,191,8976,172,189,188,161,171,187
Data 9617,9618,9619,9474,9508,9569,9570,9558,9557,9571,9553,9559,9565,9564,9563,9488
Data 9492,9524,9516,9500,9472,9532,9566,9567,9562,9556,9577,9574,9568,9552,9580,9575
Data 9576,9572,9573,9561,9560,9554,9555,9579,9578,9496,9484,9608,9604,9612,9616,9600
Data 945,223,915,960,931,963,181,964,934,920,937,948,8734,966,949,8745
Data 8801,177,8805,8804,8992,8993,247,8776,176,8729,183,8730,8319,178,9632,160
End Select
End Sub

