This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int getDecimalOfUtf8(char * utfPointer){ | |
int outPut = utfPointer[0]; //sets the final output number to the value of the first byte of the utf-8 code | |
int numStarting1 = 0; //tracks number of 0's at beggining of character to see if utf-8 | |
while ((utfPointer[0] << numStarting1 & 0x80) ? 1 : 0) //shifts bits of first byte of utfPointer and checks if the MSB is 1 or 0 | |
{ | |
numStarting1++; //increments numStarting1 | |
} | |
//At this point numStarting1 could be returned to know the length in bytes of the unicode character | |