Export to csv using FasterCSV causes strange punctuation characters
I have a client that writes a daily feature menu in Word. They then copy & paste out of Word into a Rails app that exports the menu into a csv file using FasterCSV. The problem is that some punctuation gets messed up in th开发者_StackOverflow中文版e export. I believe it may be an encoding problem, but I'm not sure how to fix it.
Here's an example:
Word version - Chef’s vegetables
After export - Chef’s vegetables
Another example:
Word version - sautéed peppers
After export - sautéed peppers
Any ideas would be a huge help!!
Word documents are not text documents. Things like smart-quotes, non-ASCII quotes, accented characters, etc. obviously get messed up. I'm not even sure if it's just a matter of UTF-8 encoding, although you could try that first--see this for more info. FasterCSV supports Ruby 1.9 encoding vi the :encoding option.
Personally, I tend to just tell people to not do that, and use an actual text editor, but that isn't always an option.
精彩评论