-1

More specificly, in C++:

#include <locale>
#include <algorithm>
#include <iostream>
#include <string>
int main() {
    std::wstring v[3] = {L"홍진호", L"이상민", L"장동민"};
    std::locale loc("Korean.949");
    std::sort(v, v + 3, loc);
    std::wcout.imbue(loc);
    std::wcout << v[0] << ' ' << v[1] << ' ' << v[2] << std::endl;
    return 0;
}

This doesn't work. I'm using Windows 10 64bit, MinGW, and GNU GCC 4.9.2.

What is the locale name for Korean, for loc?

Dannyu NDos
  • 2,458
  • 13
  • 32

1 Answers1

0

https://stackoverflow.com/a/4497266/1670021

Looks like on Windows with gcc, this may not work well. You might be able to use the C setlocale, but that's not a great option. Maybe using a blank string would work for your use case?

Community
  • 1
  • 1
Todd Christensen
  • 1,297
  • 8
  • 11
  • That might be a problem, but that is not the point here. "Korean.949" is not valid name, so I am asking what the correct is. – Dannyu NDos Apr 17 '16 at 06:29
  • Well, you can try ".949" or "ko_KR". See here: http://stackoverflow.com/questions/4406895/what-stdlocale-names-are-available-on-common-windows-compilers - locale names are implementation defined. – Todd Christensen Apr 17 '16 at 06:35
  • That name is valid, but unfornunately, MinGW doesn't support wide characters... I used narrow characters instead, but I get this weird output: ?띿쭊???댁긽誘??λ룞誘 ?댁긽誘??λ룞誘??띿쭊? – Dannyu NDos Apr 17 '16 at 07:00