From: 7stud -- Date: 2007-11-03T06:21:05+09:00 Subject: Re: Escaping non-ASCII chars for RTF export Dan Herrera wrote: > This is great information, it's really helped me move in the right > direction. > > Thanks! > There is one missing piece to the puzzle. This is what happens behind the scenes when you convert from a string written in UTF-8 format to a string written in ISO-8859-15 format: UTF-8 encoded character | | V Unicode integer | | V ISO-8859-15 encoded character If for some reason, you ever need to get the unicode integer, you can do this: str = "\xc3\xb6" #'o' with umlaut encoded in utf-8 arr = str.unpack('U') #'U' gets the unicode from a char encoded in *utf-8* only p arr #[246] --> unicode in decimal format Since unicode integers are usually written in hex format, you can do the following to get the unicode in hex format: puts "%04x" % arr[0] #00f6 -- Posted via http://www.ruby-forum.com/.