mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 05:25:33 +00:00
Fixed bug 5524 - Pass NSString to NSLog()
Hiroyuki Iwatsuki If you pass the C string directly to NSLog(), it will be garbled with Japanese and probably other language strings, or no log will be output at all. NSLog("Hello, World!"); // => "Hello, World!" NSLog("こんにちは、世界!"); // => No output... Therefore, you need to convert the string to an NSString before passing it to NSLog(). NSString *str = [NSString stringWithUTF8String:"こんにちは、世界!"]; NSLog(@"%@", str); // => "こんにちは、世界!" Thank you.
This commit is contained in:
parent
b7f711cd76
commit
cef198c9cb
|
@ -260,7 +260,10 @@ Cocoa_CreateImage(SDL_Surface * surface)
|
|||
|
||||
void SDL_NSLog(const char *text)
|
||||
{
|
||||
NSLog(@"%s", text);
|
||||
@autoreleasepool {
|
||||
NSString *str = [NSString stringWithUTF8String:text];
|
||||
NSLog(@"%@", str);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_COCOA */
|
||||
|
|
|
@ -279,7 +279,10 @@ UIKit_ForceUpdateHomeIndicator()
|
|||
#if !defined(SDL_VIDEO_DRIVER_COCOA)
|
||||
void SDL_NSLog(const char *text)
|
||||
{
|
||||
NSLog(@"%s", text);
|
||||
@autoreleasepool {
|
||||
NSString *str = [NSString stringWithUTF8String:text];
|
||||
NSLog(@"%@", str);
|
||||
}
|
||||
}
|
||||
#endif /* SDL_VIDEO_DRIVER_COCOA */
|
||||
|
||||
|
|
Loading…
Reference in a new issue