How to convert Unicode char to "Unicode HEX Position" in Arduino or C
i will share a picture here :
for example in JavaScript you can do that with charCodeAt();
! this function will return exactly the char-code and then you can convert it to hex!
for example in JavaScript i can do that like this to return exact table value
var inpString = 'س';
var myChar=0;
var output = 0;
myChar = inpString.charCodeAt(0);
output = (ToHex((myChar&0xff00)>>8 )) + (ToHex( myChar&0xff ));
function ToHex(i)
{
var sHex = "0123456789ABCDEF";
var Out = "";
Out = sHex.charAt(i&0xf);
i>>=4;
Out = sHex.charAt(i&0xf) + Out;
return Out;
}
alert(output);
So how can i do that in Arduino ? its using to send unicode char in PDU mode in Arduino i just need to convert unicode char like this -> 'س' to correct Unicode HEX Position that i shared in the picture above
for example 'س' is 0633 or 'A' is 0041 or 'ب' is 067E
console.log("س".charCodeAt(0).toString(16))
.