fpillet / NSLogger

A modern, flexible logging tool
Other
5k stars 573 forks source link

Do not convert C strings to UTF-8 #314

Closed 0xced closed 1 year ago

0xced commented 1 year ago

Today, the __FILE__ predefined macro is already encoded in UTF-8. Maybe that was not the case in 2010 when the file/line/function support was introduced in commit d43596b5753bd3d96886fd6d9cc61283cbd9edae.

Here are screenshots of what happens before and after this commit using the following code:

LogMessageRawToF(logger, __FILE__, __LINE__, __PRETTY_FUNCTION__, NULL, 2, @"👋 Hello, world!");

Before this commit, the file is not displayed because of the double UTF-8 encoding:

Screenshot before fixing the encoding issue

After this commit, the file is properly displayed:

Screenshot after fixing the encoding issue