reading characters of openfire.xml file fails if it is UTF-8 and not "locale" encoded

Description

XMLProperties.java uses a FileReader to read openfire.xml and this causes characters to be read in wrong.
Try to add <foo>å ä ö</foo> within openfire.xml and save it as UTF-8, add a breakpoint after buildDoc(reader); and verify then the read in data. It will be wrong encoded.
see also http://www.igniterealtime.org/forum/thread.jspa?messageID=151700&#151700 and http://www.stylusstudio.com/xmldev/199907/post30410.html

Environment

None

Activity

Show:

Daryl Herzmann April 5, 2010 at 4:25 PM

reopening and moving to OF

LG March 3, 2010 at 1:19 AM

Hi Daryl,

would you please re-open this issue. This is a workaround but this does not solve the problem. An XML file is UTF-8 encoded unless otherwise specified. And as far as I can tell the openfire.xml file starts with `<?xml version="1.0" encoding="UTF-8"?>´ so one must use UTF-8 encoding.

In XMLProperties.java I see
Reader reader = new BufferedReader(new InputStreamReader(in));
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tempFile), "UTF-8"));

So I think it wouldn't hurt to add `, "UTF-8"´ to the reader.

LG

Daryl Herzmann January 12, 2010 at 12:47 AM

closing as there appears to be a logical workaround.

LG November 18, 2007 at 5:46 AM

Setting "-Dfile.encoding=UTF-8" solves also this issue (see JM-1190)

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created July 22, 2007 at 8:06 PM
Updated April 11, 2010 at 12:08 PM
Resolved April 11, 2010 at 12:08 PM