From: Krzysieq Date: 2008-09-18T22:25:21+09:00 Subject: Re: How to clean an xml files from non-utf-8 chars? ------=_Part_12844_7398679.1221744775658 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Unfortunately, there's no way telling the original encoding. I would rather go for some method of removing / substituting the chars that don't belong there, but the method first suggested by Brian doesn't seem to work for some reason. Does anyone have another option? I'm investigating the reasons of failure, I will write more when I know something more. Thanks for all help anyways :) Cheers, Chris 2008/9/17 James Gray > On Sep 17, 2008, at 4:07 AM, Krzysieq wrote: > > I have a problem. I'm trying to parse with ruby some test results from >> jmeter, that are stored in xml files. Unfortunately, while they should be >> utf-8, some of them aren't. Probably because some db data isn't. In any >> case, this makes other toys break down, like xslt transformation and >> anything else that relies on the xml files being utf-8. >> >> Does anyone know, how to get rid of such characters? >> > > If you can figure out the encoding they are actually in, I recommend using > Iconv's transliterate mode: > > require "iconv" > Iconv.conv("UTF-8//TRANSLIT", old_encoding_name, data) > > James Edward Gray II > > ------=_Part_12844_7398679.1221744775658--