Unicode symbols in a string within quotes
Hi.
How can I put a unicode symbol in a string within quotes? For example, if I have this code in .lua: ['MAIN_TAB'] = "Some text and <unicode symbol of rightwards arrow>" Then in game I will see this - "Some text and →". I've found this article - https://stackoverflow.com/questions/...-symbol-in-lua The solution is: "The UTF-8 encoding of a Unicode character can be inserted in a literal string with the escape sequence \u{XXX} (note the mandatory enclosing brackets), where XXX is a sequence of one or more hexadecimal digits representing the character code point." I've tried this - ['MAIN_TAB'] = "Some text and \u{2192}" and this - ['MAIN_TAB'] = "Some text and \u2192". And it is not helpful. PS: rightwards arrow code is here - https://www.fileformat.info/info/uni...2192/index.htm |
For the german special chars I use this notation
-- ö \195\182 ß \195\159 -- ü \195\188 ä \195\164 -- Ä \195\132 -- ö \195\182 -- Ü \195\156 Not sure how to translate it for your symbol. And I'm not even sure if the symbol is included in the game fonts. |
Quote:
|
You can save Lua files in UTF-8. WoW will even ignore the BOM if you wish to add one, which is needed for most Unicode-capable IDEs to recognize that Unicode is being used.
Even though WoW will ignore the BOM in Lua files, this isn't standard feature of Lua. As such, I would avoid using Unicode symbols in function and variable names. However, Lua boasts that its strings are binary-safe, meaning you can put literally anything in them, even embeded null characters. How the host program (WoW in this case) reacts to them in their API functions is a different story. In summary, UTF-8 symbols are fine in strings and WoW will read them as-is. |
Quote:
|
Quote:
Lua Code:
PS: You can also use https://icomoon.io/app/ to generate a font that only contains the symbols you need and use it in your addon. Edit: Removed LibSharedMedia |
sezz
Don't know how you did this. I use a standard font Friz Quadrata TT (or PT Sans Narrow, or any other) but no one has this symbol - when I paste "→" in chat or in any addon, then "?" shows. |
Quote:
Where exactly do you want your addon to show the arrow? |
All times are GMT -6. The time now is 11:26 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI