I’ve been looking into moving our Rails app to 1.9 and am having lots of
trouble with string encodings, especially when it comes to file uploads.
We allow users to upload text files, which may, or may not, have
accented characters in them. If there are accented characters, we insist
that the file is UTF-8, but if there are no accented characters we don’t
care what encoding the file is.
It seems that w/ Rails 2.3.5 ALL files upload as ASCII-8BIT, regardless
of OS $LANG setting, or actual file encoding.
params[:file].external_encoding also appears to be ASCII-8BIT as well,
so I can’t use content.encode(“utf-8”, xxx) because I’ve no idea what
the file is supposed to be encoded as.
Since I’m on OSX and $LANG == en_AU.UTF-8, shouldn’t all files default
to UTF-8 unless explicitly told otherwise?
Has anyone got 2.3.5 working well w/ 1.9 when accented characters are