"Plain Text Encoding" ignored if file has com.apple.TextEncoding xattr

Originator:jediknil
Number:rdar://FB8353487 Date Originated:2020-08-11
Status:Open Resolved:
Product:TextEdit Product Version:macOS Catalina 10.15.5 (19F101)
Classification:Incorrect/Unexpected Behavior Reproducible:Yes
 
The attached file [omitted for Open Radar] uses Shift-JIS, but mistakenly got an xattr claiming it was UTF-8:

com.apple.TextEncoding: utf-8;134217984

Unsurprisingly, TextEdit refused to open this file, claiming that the contents weren’t valid UTF-8. What /was/ surprising is that even when I used the “Options” pane in TextEdit’s Open window to choose Shift-JIS, TextEdit /still/ refused to open the file and /still/ claimed that the contents were invalid UTF-8. It wasn’t until I deleted the xattr that it respected my choice in the Open window, at which point it had no trouble loading the file as Shift-JIS. Saving it also correctly wrote Shift-JIS into the com.apple.TextEncoding xattr.

Running macOS Catalina 10.15.5 (19F101), which has TextEdit 1.15 (355).

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!