New Site Design

That’s right folks! I redesigned my website, I hope you like it! Please let me know if you don’t.

It’s looking a bit bare at the moment, but hopefully I’ll come up with some things to fill it up in the future! Not much of interest has been lost in the upgrade aside a Portal 2 Mapping tutorial nobody read. Oh well, I had fun writing it. Maybe it’ll make an appearance again some day.

How to print UTF16 in C++

And this, is why I hate working with C++

Why does this have to be so damn hard? It took hours to narrow down this information, and even then it’s pretty platform specific. Iconv is open source, but who’s going to want to download an entire library just to convert UTF16 to UTF8 on windows? No one, thats who.

#include <iconv.h>
char dst[100];
memset(dst, 0, sizeof(dst));

size_t dstlen = sizeof(dst);
size_t srclen = N_BYTES_IN_UTF16_POINTER;

char * pIn = (char*)(YOUR_UTF16_POINTER);
char * pOut = dst;

iconv_t conv = iconv_open("UTF-8", "UTF-16");
size_t retn = iconv(conv, &pIn, &srclen, &pOut, &dstlen);
iconv_close(conv);

std::cout << "CONVERTED " << dst << endl;

And the documentation can be easily located with a quick google search (/sarcasm/) and found here: http://www.gnu.org/software/libiconv/documentation/libiconv-1.13/