ijoshsmith / abandoned-strings

Command line program that detects unused resource strings in an iOS or OS X application.
MIT License
378 stars 67 forks source link

utf16 #8

Open jerryhalstead opened 6 years ago

jerryhalstead commented 6 years ago

Been trying to hand prune our localization files, but they have over 2k strings from over seven years. Tried this out and it didn't find anything abandoned.

Turns out contentsOfFile is reading the strings file using utf8 encoding and our files are utf16. This causes the try to fail and an empty string returned instead of file contents.

Found something mentioned on SO that as of 2016 Apple is using utf8, but a new localization I created yesterday is utf16 as well.

Maybe consider a warning in contentsOfFile catch?

wow-such-amazing commented 6 years ago

Same issue. For me I replaced return try String(contentsOfFile: filePath, encoding: String.Encoding.utf8) with return try String(contentsOfFile: filePath)