Skip to content

Instantly share code, notes, and snippets.

View JacekRuzyczka's full-sized avatar

Jacek Rużyczka JacekRuzyczka

  • Sandkrug, Lower Saxony, Germany
View GitHub Profile
@bluzky
bluzky / string_convert.cpp
Created November 12, 2014 08:59
Convert UTF-8 to UTF-16 and vice versa
wstring utf8_to_utf16(string utf8)
{
std::vector<unsigned long> unicode;
size_t i = 0;
while (i < utf8.size())
{
unsigned long uni;
size_t todo;
bool error = false;
unsigned char ch = utf8[i++];