The purpose of this thread is collecting information about Unicode and PureBasic for reference.
Please post questions and discussions in separate threads. Thank you!
If you are new to Unicode, read this first:
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets
Also read the
Unicode section in the PureBasic Reference Manual
I'll start with posting a solution for a problem that has caused some confusion in the past.
What I'm writing here is essentially a summary of this thread.
Displaying Unicode characters
- In the IDE, choose
Compiler > Compiler Options... > [v] Create unicode executable
- For your gadgets (or wherever you want to show the text) choose a font, that actually contains the glyphs for the characters that you want to display.
- If your code uses Chr() with Unicode code points not given as variables but as constants, e.g.
then in the IDE you have to setCode: Select all
MessageRequester("Unicode test", Chr($3042))
( This is the best source file format anyway for Unicode source files and for ASCII source files.File > File format > Encoding:UTF-8
For how to convert existing "plain text" source files to UTF-8, see Josh's tip below. ) - Displaying Unicode characters with Debug only works with PB 5.30+.
Also when using Debug you must choose an appropriate font, as mentioned above.
This is done in the IDE viaFile > Preferences... > Debugger > Individual settings > [v] Use a custom font - Some information about displaying Unicode characters on the console is in this thread.