| 664 | return out; |
| 665 | } |
| 666 | static bool console_is_utf8() |
| 667 | { |
| 668 | #ifdef LINUX_BUILD |
| 669 | static bool checked = false; |
| 670 | static bool is_utf = false; |
| 671 | if (checked) |
| 672 | return is_utf; |
| 673 | |
| 674 | std::string locale = ""; |
| 675 | if (getenv("LANG")) |
| 676 | locale += getenv("LANG"); |
| 677 | if (getenv("LC_CTYPE")) |
| 678 | locale += getenv("LC_CTYPE"); |
| 679 | locale = toUpper_cp437(locale); |
| 680 | is_utf = (locale.find("UTF-8") != std::string::npos) || (locale.find("UTF8") != std::string::npos); |
| 681 | checked = true; |
| 682 | return is_utf; |
| 683 | #else |
| 684 | return true; // Since DF 53.11, Windows console is always UTF-8 |
| 685 | #endif |
| 686 | } |
| 687 | |
| 688 | DFHACK_EXPORT std::string DF2CONSOLE(const std::string &in) |
| 689 | { |
no test coverage detected