-
September 7th, 2017, 06:38 AM
#1
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
-
September 7th, 2017, 06:59 AM
#2
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. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. 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/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|