Thread: special letters
View Single Post
01-04-13, 06:30 PM   #9
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Originally Posted by Cirax View Post
Yeah the question here is why your string contains utf8 format instead of plain text.

If it's a must to where you have to use utf8 then you would want to create a table with all the special characters in it with their utf format and then making a replace/convert function to use that table.
All strings WoW passes into the Lua environment are encoded in UTF-8. Since UTF-8 was created to be backwards compatible with ANSI, any codes within the ANSI character set will be exactly the same in UTF-8. Also, there's no reason to need a conversion function to store these in Lua. Lua supports full binary in its strings, even embedded zeroes.



Originally Posted by Anja View Post
someone helped me in private message, for those who search for the same answer

i used the wrong regex
%w finds only normal letters

string.match(msg,"(.+)")

finds the rest
The result of (.+) returns the entire contents of the string msg as it matches all characters. I would recommend using the non-space identifier (%S+) instead. Note these identifiers are case sensitive in which using the opposite case returns an inverse match. For example, since the lowercase %s returns any whitespace character, the uppercase %S would return any non-whitespace character.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 01-04-13 at 06:58 PM.
  Reply With Quote