Windows curly quotes, accented characters on Linux Samba Shares and Cygwin XTerm: How to get Windows-1252 (AKA CP1252) from Linux
Before I forget: I have a bunch of files I mirror between Windows/NTFS and Linux/ext4 filesystems that include not only accented characters but curly quotes in the filenames. (I know: the easiest solution would be to just get rid of the extended characters). The curly quotes were created in Windows, so don’t render properly in standard Linux character sets (UTF-8, iso8859-1, iso8859-15, etc.).
This all came up because iTunes under Windows couldn’t find curly-quote files when it was reading from the exported Samba share filesystem rather than an attached NTFS drive. The files showed up as missing because they had different filenames.
The solution was not easily google-able, so for the record, in brief, add this to the [Global] section of /etc/samba/smb.conf:
unix charset = cp1252
display charset = cp1252
And reload Samba.
Also, to make the characters render properly from a terminal on the Linux box, first create the relevant character set:
sudo localedef -f CP1252 -i en_US en_US.CP1252
Now you can use this charset on your Linux box, and, like magic, the curly characters will be back:
export LC_ALL='en_US.cp1252'
Wouter Verhelst Mar 15
The proper fix, of course, is to teach Windows not to use abhominations instead of real, actual code pages. Yes, that is possible; I’ve done it, but I forgot how (hey, gimme a break, I don’t do Windows all that often anymore)