<p>Suppose I have this Windows wchar_t string:</p>

<pre><code>L"\x4f60\x597d"
</code></pre>

<p>and</p>

<pre><code>L"\x00e4\x00a0\x597d"
</code></pre>

<p>and would like to convert it (not necessarily programmatically; it will be a one-time thing) to GCC/Linux wchar_t format, which is UTF-32 AFAIK. How do I do it? (a general explanation would be nice, but example based on this concrete case would be helpful as well)</p>

<p><em>Please don't direct me to character conversion sites. I would like to convert from L"\x(something)" form and not "end character" form.</em></p>

Would converting from UTF-16 (the Visual C++
```
wchar_t
```
form) to UTF-8, then possibly from UTF-8 to UCS-4 (the GCC
```
wchar_t
```
form), be an acceptable answer?
If so, then in Windows you could use the
```
WideCharToMultiByte
```
function (with
```
CP_UTF8
```
for the
```
CodePage
```
parameter), for the first part of the conversion. Then you could either paste the resulting UTF-8 strings directly into your program, or convert them further.
Here
is a message showing how one person did it; you can also write your own code or do it manually (the official spec, with a section on exactly how to convert UTF-8 to UCS-4, can be found
here
). There may be an easier way, I'm not overly familiar with the conversion stuff in Linux yet.