Hi.
I am using SDL2 in DelphiXE5/XE6 and I have a problem with all SDL2 functions that return a string, the value I read are always Japanese letters. According to the documentation of SDL2 all string are encoded in UTF8. In fact SDL2 functions that I have to send a string I do with: PChar (UTF8Encode (string)) and it works perfectly.
I put a concrete case: function SDL_GetHint
Documentation of SDL:
Code:
Syntax
const char* SDL_GetHint(const char* name)
Function Parameters
name : the hint to query;
Return Value
Returns the string value of a hint or NULL if the hint isn't set.
Implementation in Delphi:
Code:
function SDL_GetHint( const name: PChar): PChar; cdecl; external 'SDL2.dll';
I have tried different ways to read the value of the string but none Works:
Code:
var
aux : string;
begin
aux := SDL_GetHint(PChar(UTF8Encode(SDL_HINT_RENDER_SCALE_QUALITY)));
aux := PChar(SDL_GetHint(PChar(UTF8Encode(SDL_HINT_RENDER_SCALE_QUALITY))));
aux := UTF8Decode(SDL_GetHint(PChar(UTF8Encode(SDL_HINT_RENDER_SCALE_QUALITY))));
aux := PChar(UTF8Decode(SDL_GetHint(PChar(UTF8Encode(SDL_HINT_RENDER_SCALE_QUALITY)))));
aux := UTF8Decode(PChar(SDL_GetHint(PChar(UTF8Encode(SDL_HINT_RENDER_SCALE_QUALITY)))));
end;
Any idea how to recover the real value of the string?
Thanks.
Bookmarks