XML files in UTF-8 were broken by inserting variables if they "parsable". Non-latin chars become spoiled.

Description

In install.xml:

<pack id="server" name="Server" required="no" preselected="no">
<parsable type="xml" encoding="UTF-8" targetfile="$INSTALL_PATH/config/mainboard.xml"/>

Should be:

But in result file:

How to make normal in current version 5.1.2:

<parsable type="java" encoding="ISO-8859-1" targetfile="$INSTALL_PATH/config/mainboard.xml"/>

Why ISO-8859-1??... I dont know but it works.

How I tried fix it in source code:

Looking to VariableSubstitutorInputStream. There is_ field private Reader substitutorReader;_
"Reader" is problematic here because we have:
@Override
public int read() throws IOException
{
return substitutorReader.read();
}
Mixing of "Reader" and "InputStream" is not work well with different charsets.

Environment

win10pro64
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

Status

Assignee

Unassigned

Reporter

Evgeniy Egorov

Impact

Functional - may break existing environments

Components

Affects versions

Priority

High
Configure