Better text printing for UTF-8 characters
This commit is contained in:
parent
75894c0d8b
commit
eb00bbd7f9
1 changed files with 9 additions and 1 deletions
|
@ -117,7 +117,15 @@ PrintKey(SDL_Keysym * sym, SDL_bool pressed, SDL_bool repeat)
|
|||
static void
|
||||
PrintText(char *text)
|
||||
{
|
||||
SDL_Log("Text: %s\n", text);
|
||||
unsigned char *spot, expanded[1024];
|
||||
|
||||
expanded[0] = '\0';
|
||||
for ( spot = text; *spot; ++spot )
|
||||
{
|
||||
size_t length = SDL_strlen(expanded);
|
||||
SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", *spot);
|
||||
}
|
||||
SDL_Log("Text (%s): \"%s%s\"\n", expanded, *text == '"' ? "\\" : "", text);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue