@@ -263,12 +263,36 @@ const char **narrow_argv(int argc, const wchar_t **argv_wide)
263
263
return argv_narrow;
264
264
}
265
265
266
+ /* ******************************************************************\
267
+
268
+ Function: utf8_to_utf16_big_endian
269
+
270
+ Inputs: String in UTF-8 format
271
+
272
+ Outputs: String in UTF-16BE format
273
+
274
+ Purpose: Note this requires g++-5 libstdc++ / libc++ / MSVC2010+
275
+
276
+ \*******************************************************************/
277
+
266
278
std::wstring utf8_to_utf16_big_endian (const std::string& in)
267
279
{
268
280
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t > > converter;
269
281
return converter.from_bytes (in);
270
282
}
271
283
284
+ /* ******************************************************************\
285
+
286
+ Function: utf8_to_utf16_little_endian
287
+
288
+ Inputs: String in UTF-8 format
289
+
290
+ Outputs: String in UTF-16LE format
291
+
292
+ Purpose: Note this requires g++-5 libstdc++ / libc++ / MSVC2010+
293
+
294
+ \*******************************************************************/
295
+
272
296
std::wstring utf8_to_utf16_little_endian (const std::string& in)
273
297
{
274
298
const std::codecvt_mode mode=std::codecvt_mode::little_endian;
@@ -282,6 +306,19 @@ std::wstring utf8_to_utf16_little_endian(const std::string& in)
282
306
return converter.from_bytes (in);
283
307
}
284
308
309
+ /* ******************************************************************\
310
+
311
+ Function: utf16_little_endian_to_ascii
312
+
313
+ Inputs: String in UTF-16LE format
314
+
315
+ Outputs: String in US-ASCII format, with \uxxxx escapes for other
316
+ characters
317
+
318
+ Purpose:
319
+
320
+ \*******************************************************************/
321
+
285
322
std::string utf16_little_endian_to_ascii (const std::wstring& in)
286
323
{
287
324
std::ostringstream result;
0 commit comments