How to know if a string stored in the resource file is Unicode or ISOLatin1? | developer.brewmp.com How to know if a string stored in the resource file is Unicode or ISOLatin1? | developer.brewmp.com

Developer

How to know if a string stored in the resource file is Unicode or ISOLatin1?

Forums:

Hi,

I have 2 strings in a resource file.

<?xml version="1.0" encoding="utf-8"?>

Foo

Bar

Using Brew API's how can I find out that a particular string resource is of encoding Unicode or ISOLATIN1.

One can know the size using ISHELL_GetResSize, but when I want to reference the string ... I am not sure if I have to use char * or AECHAR *.

--
Regards,
Libin

One solution I tried is to check if the last 2 characters of the string.
If last 2 character == \0\0 ... Then Unicode else ISOLATIN1.
Is any draw backs in this method?

One solution I tried is to check if the last 2 characters of the string.
If last 2 character == \0\0 ... Then Unicode else ISOLATIN1.
Is any draw backs in this method?

Hope this works:
byte * pData; //resource data buffer
byte nType, nType2;
//load resource data into pData.
nType = *pData;
nType2 = pData[1];
if(nType == 0xFF && nType2 == 0xFE) //unicode
if(nType == 3) //isolatin1

Hope this works:
byte * pData; //resource data buffer
byte nType, nType2;
//load resource data into pData.
nType = *pData;
nType2 = pData[1];
if(nType == 0xFF && nType2 == 0xFE) //unicode
if(nType == 3) //isolatin1

I did not understand :( Can you please elaborate the numbers we are checking for?
--
Thank You
adhudase;81359 wrote:Hope this works:
byte * pData; //resource data buffer
byte nType, nType2;
//load resource data into pData.
nType = *pData;
nType2 = pData[1];
if(nType == 0xFF && nType2 == 0xFE) //unicode
if(nType == 3) //isolatin1

I did not understand :( Can you please elaborate the numbers we are checking for?
--
Thank You
adhudase;81359 wrote:Hope this works:
byte * pData; //resource data buffer
byte nType, nType2;
//load resource data into pData.
nType = *pData;
nType2 = pData[1];
if(nType == 0xFF && nType2 == 0xFE) //unicode
if(nType == 3) //isolatin1

libin_v;81362 wrote:I did not understand :( Can you please elaborate the numbers we are checking for?
--
Thank You
what part u dint understand here? what elabor req?
adhudase;81359 wrote:Hope this works:
byte * pData; //resource data buffer
byte nType, nType2;
//load resource data into pData.
nType = *pData;
nType2 = pData[1];
if(nType == 0xFF && nType2 == 0xFE) //unicode
if(nType == 3) //isolatin1
if first and second byte are 255 and 254, then u might treat it as unicode, else first byte is 3 then it is isolatin.
Thanks atul, this is useful.

libin_v;81362 wrote:I did not understand :( Can you please elaborate the numbers we are checking for?
--
Thank You
what part u dint understand here? what elabor req?
adhudase;81359 wrote:Hope this works:
byte * pData; //resource data buffer
byte nType, nType2;
//load resource data into pData.
nType = *pData;
nType2 = pData[1];
if(nType == 0xFF && nType2 == 0xFE) //unicode
if(nType == 3) //isolatin1
if first and second byte are 255 and 254, then u might treat it as unicode, else first byte is 3 then it is isolatin.
Thanks atul, this is useful.