* Open iconv converter. */
| 147 | * Open iconv converter. |
| 148 | */ |
| 149 | static std::optional<iconv_t> OpenIconv(std::string from, std::string to) |
| 150 | { |
| 151 | iconv_t convd = iconv_open(from.c_str(), to.c_str()); |
| 152 | if (convd == reinterpret_cast<iconv_t>(-1)) { |
| 153 | Debug(misc, 0, "[iconv] conversion from codeset '{}' to '{}' unsupported", from, to); |
| 154 | return std::nullopt; |
| 155 | } |
| 156 | return convd; |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * Convert from OpenTTD's encoding to that of the local environment |