Carlos
3/23/2005 6:41:00 PM
[Peter C <pkchau@gmail.com>, 2005-03-23 19.19 CET]
> I'm grabbing strings from an IE browsers using WATIR. The text in IE
> is encoded in UTF-8 and shows up correctly in a DOS prompt. I want to
> do string compares between this UTF-8 string with a ANSI string from
> my script. How can I convert the UTF-8 to an ANSI?
I don't know what are ANSI strings. If they are 8-bit, latin-1 encoded
strings, then you can convert between them and utf8 using pack and unpack:
utf8 -> latin1: "abcd".unpack("U*").pack("C*")
latin1 -> utf8: "abcd".unpack("C*").pack("U*")
HTH