I have a mysql database with a InnoDB table in utf8_general_ci
encoding. Inside this table there is a column "path", varchar(255),
What I am trying to do now, is to use this path from the database to
look up a local file and transmit this file to the user. The problem
is, that my program is not able to open any files, that contain
special characters (e.g. ÄÖÜ.txt) in their path (without special
characters its fine). In these cases, the path-string seems to be
screwed (if I print it to the console it is "ÃÃ-ÃOE.txt").
However, when I show the pathname inside the browser, or look at it in
the database (phpmyadmin), the special characters seem to be correct.
I already added the "encoding: utf8" line to my database.yml file, so
this shouldnt be the problem.
Here is the code to send the file inside my controller:
path = Document.find(params[:id]).path
puts path # for "ÄÖÜ.txt" gives "ÃÃ-ÃOE.txt" on console
send_file(path) # gives: Cannot read file ÄÖÜ.txt in browser
Did anybody already have a similar problem or can give me some advice
how to fix this?
Thanks in advance, Erik Weitnauer.