You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4cxx-dev@logging.apache.org by "Sergiy Tkachuk (JIRA)" <lo...@logging.apache.org> on 2014/11/13 22:34:34 UTC

[jira] [Comment Edited] (LOGCXX-369) Load Properties File Fails When There Are multibyte Characters in the Path

    [ https://issues.apache.org/jira/browse/LOGCXX-369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14211329#comment-14211329 ] 

Sergiy Tkachuk edited comment on LOGCXX-369 at 11/13/14 9:34 PM:
-----------------------------------------------------------------

I have the same issue if I have Ukrainian chars in user name.

I have issues with the expanding following line in *log4cxx.config*:

{code:xml}
      <param name="file" value="${LOCALAPPDATA}\MyProduct\log4cxx.txt" />
{code}

I use VS2010.


was (Author: sergtk):
I have the same issue if I have Ukrainian chars in user name.

I have issues with the expanding following line in *log4cxx.config*:

{code:xml}
      <param name="file" value="${LOCALAPPDATA}\MyProduct\log4cxx.txt" />
{code}

I used VS2010.

> Load Properties File Fails When There Are multibyte Characters in the Path
> --------------------------------------------------------------------------
>
>                 Key: LOGCXX-369
>                 URL: https://issues.apache.org/jira/browse/LOGCXX-369
>             Project: Log4cxx
>          Issue Type: Bug
>          Components: Configurator
>    Affects Versions: 0.10.0
>         Environment: Windows XP SP2
> VC8.0SP1
>            Reporter: Starwalker
>            Assignee: Curt Arnold
>
> Load properties file fails when calling PropertyConfigurator::configure using a MBCS string which type is char * or std::string and contains multibyte characters, such as Chinese characters.
> Analyse
> When calling PropertyConfigurator::configure using a MBCS string which type is char * or std::string, the constructor of File will call Transcoder::decode to convert MBCS string to DBCS string. When meets the byte which is greater than or equal to 0x80, the function will call MbstowcsCharsetDecoder::decode to process the following characters. But there is an error in MbstowcsCharsetDecoder::decode when calculating the offset after calling mbsrtowcs.
> size_t converted = mbsrtowcs(buf,       // This function returns the number of wide characters, maybe not equal to the number of the bytes of multibyte characters
>     &src,
>     requested,
>     &mbstate);
> if (converted == (size_t) -1) {
>     stat = APR_BADARG;
>     in.position(src - in.data());
>     break;
> } else {
>     stat = append(out, buf);
>     in.position(in.position() + converted);    // Here, the number of the bytes of multibyte characters should be added, not the number of wide characters
> }
> The path "D:\Temp\中文文件夹\STC\Config\Log.properties" becomes "D:\Temp\中文文件夹\STC\Config\Log.propertiesrties" after convertion.
> There are 10 bytes for the 5 Chinese characters, but only 5 wide characters. Because the error above, last 5 characters repeated.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)