Unicode character functions (chr/fromCharCode and ord/charCodeAt)

Apr 17, 2006 20:27

As some of you may have noticed, S2's Unicode support is rather buggy. I've written a little package to convert S2 strings to and from their Unicode character numbers. If you've programmed Perl, this is the equivalent of chr() and ord(). If you've programmed Java or JavaScript, this is the same as fromCharCode() and charCodeAt(). I've tested it on ( Read more... )

string functions

Leave a comment

Comments 6

kunzite1 April 18 2006, 01:39:43 UTC
i have no idea what exactly this all does, but, i just wanted to let you know that you win the s2 internets.

that is all.

Reply

night_watch April 18 2006, 05:46:18 UTC
Short answer: It's just PHP's chr and ord, Unicode-aware. The lack of them in S2 annoyed me for a while, so I decided to write them myself.

If you're asking how the implementation works, well, it's a huge giant mess and I'm amazed it seems to work at all.

Reply

kunzite1 April 18 2006, 05:48:25 UTC
i understand the php man pages.

i'm completely lost with the implementation. that is why you win. :)

Reply


(The comment has been removed)

night_watch April 18 2006, 17:08:35 UTC
Hmm, that is odd. That function is pretty hairy, though, so I wouldn't be surprised if I made a typo somewhere. I was testing it with Japanese katakana myself.

I'll take a look at it and possibly post a bugfix when I get time. Thanks!

Reply

night_watch April 19 2006, 02:54:01 UTC
Okay, try it now. I found what I think is the problem: somehow an extra character was getting inserted in the fundamentalString variable (the one with the huge mess of Unicode). Your examples actually worked fine on my layer, which didn't have that problem.

Not sure what caused that. Probably something with the escaping for this journal.

Reply

(The comment has been removed)


Leave a comment

Up