Skip to content

Ensure macOS logging uses UTF-8 #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/Support/Logging-Mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@
#import <Foundation/Foundation.h>

void IndexStoreDB::Log_impl(const char *loggerName, const char *message) {
// Using NSLog instead of stderr, to avoid interleaving with other log output in the process.
// NSLog also logs to asl.
NSLog(@"%s: %s", loggerName, message);
// Using NSLog instead of stderr, to avoid interleaving with other log output
// in the process. NSLog also logs to asl. Note that we need to print as an
// NSString here, since printing the C string with '%s' would use the default
// system encoding instead of UTF-8.
NSLog(@"%s: %@", loggerName, [NSString stringWithUTF8String:message]);
}

#endif