Unicode conversion bug?
by Jari · in Torque Game Engine · 04/29/2006 (11:05 am) · 1 replies
Hi, I think there's a bug in the unicode conversion functions.
This is very difficult to demonstrade because these forums don't allow scandinavian characters and the bug is related to them and I don't know how you american folks can test this but here goes anyway:
Put this in your engine and put some wierd string to testString, compile and call tu() then see the windows system console not the torque console for interesting results...
calling tu() outputs:

I put six scandinavian chars in testString and that's what it gave.
This is a problem because I was trying to execute and exe from my desktop but since path to the desktop has scandinavian chars it doesnt work.
This is very difficult to demonstrade because these forums don't allow scandinavian characters and the bug is related to them and I don't know how you american folks can test this but here goes anyway:
Put this in your engine and put some wierd string to testString, compile and call tu() then see the windows system console not the torque console for interesting results...
#include <stdio.h> // use the std console directly
char * testString = ""; // but the scandinavian characters here!
ConsoleFunction(tu,void,1,1,"tests unicode")
{
UTF16 test16[2048];
UTF8 test8[2048];
printf("testing unicode\n");
printf("%s --- %d\n",testString,dStrlen(testString));
// first convert the testString to unicode
convertUTF8toUTF16((UTF8 *)testString, test16, sizeof(test16));
// then convert it back to ascii
convertUTF16toUTF8(test16, test8, sizeof(test8));
printf("%s --- %d\n",test8,dStrlen(test8));
}calling tu() outputs:

I put six scandinavian chars in testString and that's what it gave.
This is a problem because I was trying to execute and exe from my desktop but since path to the desktop has scandinavian chars it doesnt work.
Torque Owner Jari