Converts a string from the system charset to UTF-8.
| 1814 | |
| 1815 | // Converts a string from the system charset to UTF-8. |
| 1816 | void ISC_systemToUtf8(Firebird::AbstractString& str) |
| 1817 | { |
| 1818 | if (str.isEmpty()) |
| 1819 | return; |
| 1820 | |
| 1821 | #if defined(WIN_NT) |
| 1822 | WideCharBuffer<MAX_PATH> wBuffer; |
| 1823 | |
| 1824 | if (!wBuffer.fromString(CP_ACP, str) || !wBuffer.toString(CP_UTF8, str)) |
| 1825 | { |
| 1826 | DWORD err = GetLastError(); |
| 1827 | status_exception::raise( |
| 1828 | Arg::Gds(isc_bad_conn_str) << Arg::Gds(isc_transliteration_failed) << |
| 1829 | Arg::Windows(err)); |
| 1830 | } |
| 1831 | |
| 1832 | #elif defined(HAVE_ICONV_H) |
| 1833 | iConv().systemToUtf8.convert(str); |
| 1834 | #endif |
| 1835 | } |
| 1836 | |
| 1837 | |
| 1838 | // Converts a string from UTF-8 to the system charset. |
no test coverage detected