[ 
https://issues.apache.org/jira/browse/LOGCXX-371?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thorsten Schöning resolved LOGCXX-371.
--------------------------------------

    Resolution: Won't Fix

I will close this issue because for compatibility reasons with Java properties 
files need to be encoded as LATIN-1 only, not multibyte characters are allowed.

> The encoding of a .properties file is ISO-8859-1, also known as Latin-1.

http://en.wikipedia.org/wiki/.properties

> When the file path for file appender in the properties file contains 
> multibyte characters, log4cxx creates wrong file.
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: LOGCXX-371
>                 URL: https://issues.apache.org/jira/browse/LOGCXX-371
>             Project: Log4cxx
>          Issue Type: Bug
>          Components: Configurator
>    Affects Versions: 0.10.0
>         Environment: Windows XP SP2
> VC8.0SP1
>            Reporter: Starwalker
>            Assignee: Curt Arnold
>
> Using properties file for configurating log4cxx, the file property for 
> FileAppender contains multibyte characters, such as Chinese characters, 
> log4cxx creates wrong file.
> Analyse
> When log4cxx reads properties file, the contents will be converted to utf-16 
> as follows:
> while(in->read(buf) >= 0) {
>      buf.flip();
>      log4cxx_status_t stat = dec->decode(buf, output);    // Calling 
> log4cxx::helpers::ISOLatinCharsetDecoder::decode to convert each byte in buf 
> to UTF16.
>      if (stat != 0) {
>          throw IOException(stat);
>      }
>      if (buf.remaining() > 0) {
>          memmove(buf.data(), buf.current(), buf.remaining());
>          buf.limit(buf.remaining());
>      } else {
>          buf.clear();
>      }
> }
> Because of log4cxx::helpers::ISOLatinCharsetDecoder::decode converts by each 
> byte each time, the multibytes character is wrong after the conversion. And 
> the file path is wrong.
> If the file path is "D:\\Temp\\中文文件夹\\STC.log" in the properties file, after 
> converstion the file path becomes to "D:\Temp\ÖÐÎÄÎļþ¼Ð\STC.log".



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to