You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2008/03/12 00:02:47 UTC

[jira] Commented: (STDCXX-520) codecvt1.cpp example exits with exitcode=1

    [ https://issues.apache.org/jira/browse/STDCXX-520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12577642#action_12577642 ] 

Martin Sebor commented on STDCXX-520:
-------------------------------------

The example shows how to convert character strings representing Japanese (i.e., ja_JP) weekday names between the UTF-8, Shift_JIS, and EUC-JP encodings.

When invoked with no arguments or special variables in the environment it abends like so:

{noformat}
$ ./codecvt1 
ja_JP.UTF-8 -> INT -> ja_JP.UTF-8
  Size comparison of buffers yields equal
  Content comparison of buffers yields equal
Caught an exception: /home/sebor/stdcxx/src/locale_combine.cpp:644: std::locale::locale(const char*): bad locale name: "ja_JP.Shift_JIS"
{noformat}

But when invoked with the {{RWSTD_LOCALE_ROOT}} environment variable set to point to the root of a directory tree containing the three locales above, i.e., ja_JP.UTF-8, ja_JP.Shift_JIS, and ja_JP.EUC-JP, it produces the expected output:
  
{noformat}
$ make -C../bin ja_JP.UTF-8 ja_JP.Shift_JIS ja_JP.EUC-JP && RWSTD_LOCALE_ROOT=../nls ./codecvt1 
make: Entering directory `/build/sebor/stdcxx-gcc-4.1.2-15D/bin'
./localedef -w -c -f /home/sebor/stdcxx/etc/nls/charmaps/UTF-8 -i /home/sebor/stdcxx/etc/nls/src/ja_JP /build/sebor/stdcxx-gcc-4.1.2-15D/nls/ja_JP.UTF-8
./localedef -w -c -f /home/sebor/stdcxx/etc/nls/charmaps/Shift_JIS -i /home/sebor/stdcxx/etc/nls/src/ja_JP /build/sebor/stdcxx-gcc-4.1.2-15D/nls/ja_JP.Shift_JIS
./localedef -w -c -f /home/sebor/stdcxx/etc/nls/charmaps/EUC-JP -i /home/sebor/stdcxx/etc/nls/src/ja_JP /build/sebor/stdcxx-gcc-4.1.2-15D/nls/ja_JP.EUC-JP
make: Leaving directory `/build/sebor/stdcxx-gcc-4.1.2-15D/bin'
ja_JP.UTF-8 -> INT -> ja_JP.UTF-8
  Size comparison of buffers yields equal
  Content comparison of buffers yields equal
ja_JP.Shift_JIS -> INT -> ja_JP.Shift_JIS
  Size comparison of buffers yields equal
  Content comparison of buffers yields equal
ja_JP.EUC-JP -> INT -> ja_JP.EUC-JP
  Size comparison of buffers yields equal
  Content comparison of buffers yields equal

EUC-JP -> INT -> UTF-8 conversion
  Size    comparison of buffers yields  equal
  Content comparison of buffers yields equal
{noformat}

> codecvt1.cpp example exits with exitcode=1
> ------------------------------------------
>
>                 Key: STDCXX-520
>                 URL: https://issues.apache.org/jira/browse/STDCXX-520
>             Project: C++ Standard Library
>          Issue Type: Improvement
>          Components: Examples
>    Affects Versions: 4.1.3
>         Environment: All
>            Reporter: Farid Zaripov
>            Assignee: Martin Sebor
>            Priority: Minor
>             Fix For: 4.2.1
>
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> codecvt1.cpp example exits with exitcode=1 because of no requested locales are installed.
> The thread in mailing-list: http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03703.html
> ----------------------
> codecvt1 should probably be disabled for now (until we figure
> out how to get it to work) and it should also be renamed to
> something more descriptive. Testing three hardwired encodings
> doesn't seem like a good idea for a simple example, so maybe
> we could split it up into codecvt-sjis.cpp, codecvt-eucjp,
> and codecvt-utf8.cpp.
> ----------------------

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.