New problem with Neko/.CPP and strings and utf8, extended ascii and all that jazz
74 views
Skip to first unread message
Keith Weatherby II
unread,
Jul 8, 2017, 11:20:27 AM7/8/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Haxe
So some of you probably already know that I am working on a ascii/extended ascii text renderer in haxeflixel. My original problems stemmed with the fact that neko/.cpp uses essentially an array of bytes for strings, instead of the regular unicode strings in other platforms. So my solution was to use the UTF8 Class' "iter" function, to iterate over each character and store their character codes in an array.
So I was able to get everything pretty much working by using the UTF8 class however I've run into a new problem. When I want to check for a character I use String.fromCharCode() -- only problem is the same problem I had before, fromCharCode doesn't work correctly in neko or cpp targets. Also I can't use the Utf8.decode function because it's reporting invalid character in the character string, my guess is that an ISO string is only the lower 127 characters so that means I can't use that.
Does anyone have any other suggestions for how to return a character from a string in the neko/windows targets?
The only thing I can think of is actually using UTF8.iter just like I did on the whole character string and instead do it on a single character, then I can compare character codes.
Any suggestions?
azrafe7
unread,
Jul 9, 2017, 3:12:11 AM7/9/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Haxe
Hey Keith,
not sure I understand exactly what you're trying to do, so if you can post a little example would surely help clarify things.
In the meantime I'll point you to this lib https://github.com/mandel59/unifill which used to cover unicode in pretty much all targets (I still use it from time to time) and comes from a pre haxe.Utf8 era.
Cheers, azrafe7
Keith Weatherby II
unread,
Jul 9, 2017, 11:44:41 AM7/9/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Haxe
Essentially I want to convert Utf8 characters into standard haxe string that works on windows/neko targets (as well as flash and html5), that will work for extended ascii codes. I have a string of 256 characters that corresponds to the 256 ascii+extended codes (ibm code page 437) -- I can't convert them to the proper characters on cpp/neko targets. String.fromCharCode() doesn't work because it's a utf8 string, however, apparently the haxe.utf8 class doesn't really have any functions I can use there either. I can't run decode on it, because it says the characters in my character string are invalid and throws an exception. I'm guessing this is because an ISO string is essentially regular ascii ie < 128 - The type of characters I need to grab/convert are like the shaded block ones or the ones to make little text windows (in other words the extended set or those 128 and above)
Did that do a better job at explaining what I want? (I have trouble explaining things clearly)
Keith
Keith Weatherby II
unread,
Jul 9, 2017, 11:51:29 AM7/9/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Haxe
btw i just used haxelib to install unifill so if I don't come up with something satisfactory soon, I'll probably convert my code to use it.
On Sunday, July 9, 2017 at 3:12:11 AM UTC-4, azrafe7 wrote:
Ashiq A.
unread,
Jul 9, 2017, 2:11:25 PM7/9/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haxe...@googlegroups.com
Unifill looks awesome, thanks for sharing.
Keith: please let us know if you get this working in HaxeFlixel. I struggled with non-ACII characters in HaxeFlixel a couple of year ago and gave up.