[Rails] Re: escape Word chracters for PostGRES

2010-01-07 Thread Michael Nikitochkin
Philip Hallstrom wrote: >>tc.row_id = r_id >>tc.content = cell >> end > > Try getting the fields you want and putting them in directly, ignoring > any CSV stuff... That is, get them out of the CSV file, but don't let > your CSV library mess with them.

[Rails] Re: escape Word chracters for PostGRES

2009-10-22 Thread Marnen Laibow-Koser
Dan Berger wrote: > OK, we solved it with a handful or regexs > > cell.gsub!("\222", "'") > cell.gsub!("\226", "—") > cell.gsub!("\223", '"') > cell.gsub!("\221", "'") > cell.gsub!("\224", '"') This seems like a very bad solution -- particularly the 2nd line, which is pre-escaped HTML instead o

[Rails] Re: escape Word chracters for PostGRES

2009-10-22 Thread Matt Jones
A good LART is also helpful in getting users to stop pasting Word's garbage quotes... :) --Matt Jones On Oct 22, 10:27 am, Dan Berger wrote: > OK, we solved it with a handful or regexs > > cell.gsub!("\222", "'") > cell.gsub!("\226", "—") > cell.gsub!("\223", '"') > cell.gsub!("\221", "'") > ce

[Rails] Re: escape Word chracters for PostGRES

2009-10-22 Thread Dan Berger
OK, we solved it with a handful or regexs cell.gsub!("\222", "'") cell.gsub!("\226", "—") cell.gsub!("\223", '"') cell.gsub!("\221", "'") cell.gsub!("\224", '"') Thanks! -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message b

[Rails] Re: escape Word chracters for PostGRES

2009-10-21 Thread Marnen Laibow-Koser
Dan Berger wrote: > Again, thanks. I did pull out the Iconv, and still, the same results. > Using a strait form, yes, I can get a curly quote in and out. OK. Then your app and DB are talking the same encoding. Great. (And remember to specify UTF8 in your HTML headers.) > Just not > when that

[Rails] Re: escape Word chracters for PostGRES

2009-10-21 Thread Philip Hallstrom
> Again, thanks. I did pull out the Iconv, and still, the same results. > Using a strait form, yes, I can get a curly quote in and out. Just not > when that curly quote is in a .csv, which I parse into an array of > arrays, like this: > > [["a", "b", "c"],["cell1", "cell2", "cell3"]] and then inpu

[Rails] Re: escape Word chracters for PostGRES

2009-10-21 Thread Dan Berger
Again, thanks. I did pull out the Iconv, and still, the same results. Using a strait form, yes, I can get a curly quote in and out. Just not when that curly quote is in a .csv, which I parse into an array of arrays, like this: [["a", "b", "c"],["cell1", "cell2", "cell3"]] and then input into t

[Rails] Re: escape Word chracters for PostGRES

2009-10-21 Thread Marnen Laibow-Koser
Dan Berger wrote: > OK, I added this line to my database.yml file: > > development: > encoding: utf8 > ... > ... > > And that provides the same results. When I now call this on each string: > > str = Iconv.conv('UTF-8//TRANSLIT','ISO-8859-1',str) > > those curly quotes are now preceded b

[Rails] Re: escape Word chracters for PostGRES

2009-10-21 Thread Dan Berger
OK, I added this line to my database.yml file: development: encoding: utf8 ... ... And that provides the same results. When I now call this on each string: str = Iconv.conv('UTF-8//TRANSLIT','ISO-8859-1',str) those curly quotes are now preceded by a "Â", which goes into the database lik

[Rails] Re: escape Word chracters for PostGRES

2009-10-21 Thread Marnen Laibow-Koser
Dan Berger wrote: > Marnen Laibow-Koser wrote: >> >> Are the characters getting into the database properly? > No, the system is chocking at this character >> >> Is your database encoding set to UTF8? > Yes >> >> Does your database.yml file specify UTF8 encoding? > No That could be your pro

[Rails] Re: escape Word chracters for PostGRES

2009-10-21 Thread Dan Berger
Marnen Laibow-Koser wrote: > > Are the characters getting into the database properly? No, the system is chocking at this character > > Is your database encoding set to UTF8? Yes > > Does your database.yml file specify UTF8 encoding? No > > What exactly are the problems you're seeing? Spec

[Rails] Re: escape Word chracters for PostGRES

2009-10-21 Thread Marnen Laibow-Koser
Dan Berger wrote: > Hi, I am working on an app that reads a .csv file and loads each cell as > a row into a database. However much I discourage users to copy and past > curly quotes from MS Word into their .csv, I need to build in a way to > handle this. > > Using the create method, my generated