Thanks John
The problem is solved!! I have created a function whose entry is a char and the output is a PMString.
My char variable has UTF-8 encoding. This type of encoding is described in "http://en.wikipedia.org/wiki/UTF-8".
The key is to convert each char to integer, but some characters (for example cyrillic) are saved into 2 or 3 bytes. So it's neccesary to read these 2 or 3 bytes to generate their decimals.
For example:
char myText[] = "й"
myText has 2 bytes: 11010000 and 10111001, so that, reads these 2 bytes and transforms to decimal (1081). This number is assigned to PMString with the "AppendW" function.
This is the function (it works with 1, 2 or 3 bytes):
PMString Convert_UTF8_to_PMString (char * myText)
{
PMString myString;
int total;
char binary[4];
bool two_bytes = false;
bool third_byte = false;
for (int cont=0; cont < strlen(myText); cont++)
{
int i = CHAR_BIT;
while(i>4)
{
--i;
binary[7-ib]=(const char)(myText[cont]&(1 << i) ? '1' : '0');
}
int num = myText[cont];
if (strncmp(binary,"110",3)==0)
{
// 2 BYTES
two_bytes = true;
total = (num+64)*64;
}
else if (strncmp(binary,"1110",4)==0)
{
// 3 BYTES
two_bytes = false;
total = (num+32)*4096;
}
else if (strncmp(binary,"10",2)==0)
{
if (two_bytes)
{
myString.AppendW(total + num + 128);
}
else
{
if (third_byte)
{
third_byte = false;
myString.AppendW(total + num + 128);
}
else
{
total = total + ((num + 128)*64);
third_byte = true;
}
}
}
else
{
// 1 BYTE
two_bytes = false;
myString.AppendW(num);
}
}
return myString;
}
Thanks!