We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5524

Summary: [Patch] Pass NSString to NSLog()
Product: SDL Reporter: Hiroyuki Iwatsuki <don>
Component: videoAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86_64   
OS: macOS 10.15   
Attachments: Fix to pass NSString to NSLog().

Description Hiroyuki Iwatsuki 2021-02-01 04:28:29 UTC
Created attachment 4746 [details]
Fix to pass NSString to NSLog().

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.
Comment 1 Sam Lantinga 2021-02-01 16:56:11 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/c47106665724