Skip to content Skip to sidebar Skip to footer

Parsing French Text With Simple-framework Not Working

I'm using simpleFramework for parsing an xml file in my android app. My problem is in parsing french text like lets say this tag écrite The resul

Solution 1:

I have hit this issue before whilst using a SAX parser. When reading the file with a Java InputStream you need to specify the encoding of the stream in code- perhaps by reading the first line of the file as you have shown. Here is the code for assigning the encoding;

SAXParserFactorysaxParserFactory= SAXParserFactory.newInstance();     
finalSAXParsersaxParser= saxParserFactory.newSAXParser();
// Note the encoding on the reader...finalReaderreader=newInputStreamReader(<your file stream>, "UTF-8");       
finalInputSourceinputSource=newInputSource(reader);        
inputSource.setEncoding("UTF-8");
saxParser.parse(inputSource, <some handler>);

Hope that helps. If not- post back with how you are reading the XML file.

Post a Comment for "Parsing French Text With Simple-framework Not Working"