codecvt_byname not working on Linux gcc
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: codecvt_byname not working on Linux gcc

  1. #1
    Join Date
    Apr 2017
    Posts
    8

    codecvt_byname not working on Linux gcc

    gcc 7.1 with C11 linux

    Code:
    fin.imbue(std::locale(fin.getloc(),
                  new std::codecvt_byname<wchar_t, char, std::mbstate_t>("zh_CN.gb18030")));
    produces:
    terminate called after throwing an instance of 'std::runtime_error'
    what(): locale::facet::_S_create_c_locale name not valid
    Aborted (core dumped)

    The code has been taken from:
    http://en.cppreference.com/w/cpp/locale/codecvt_byname

    I have tried as well with with en_US.UTF-8, but the result is the same.
    What is the problem? gcc dies not support localization library?

    Where to find valid list of locale names?
    Last edited by Pancevo1956; September 7th, 2017 at 06:56 AM. Reason: Added code tags

  2. #2
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    5,708

    Re: codecvt_byname not working on Linux gcc

    See https://stackoverflow.com/questions/...-names-windows for code that displays all the valid available locale names.

    Also, from a console
    locale -a

    should also display the available names.
    All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/

    C++17 Compiler: Microsoft VS2017 (15.3.4)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This a Codeguru.com survey!


On-Demand Webinars (sponsored)