Re: xor of unicode strings
Yitzchak Scott-Thoennes <[email protected]>
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 21 Apr 2004, Bernie Cosell wrote: > I'm not sure if this is 'fun', but it might be at least curious: I don't > have a UTF-8 system handy to try, but I'm wondering: what happens with > the string-xor operator on UTF-8 strings. It obviously cannot work byte- > by-byte, but it seems like it is going to be a bit tricky figuring out > what you get when you xor a 1 byte character with a 2-byte one [I guess > what it would have to do to be 'correct' would be to convert the UTF to > "real Unicode", XOR the 32-bit "characters" together, and then compress > that resulting "character" back to UTF-8... You got it! What happens with ~ is somewhat more complicated...