eweitnauer-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org
2007-Nov-30 12:36 UTC
Screwed Special Characters in an utf8 String Read From Database
Hello,
I have a mysql database with a InnoDB table in utf8_general_ci
encoding. Inside this table there is a column "path", varchar(255),
utf8_general_ci.
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:
def send_document
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
end
Did anybody already have a similar problem or can give me some advice
how to fix this?
Thanks in advance, Erik Weitnauer.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Possibly Parallel Threads
- Problem with ONE of the Special German Characters
- Using UTF8 under mysql in Centos6
- R-alpha: ISO-latin-1 characters in strings -- print.default & PARSE(?) problems
- Mysql::Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)
- Update to website not printing special Characters
