We had this exact issue about 6 months ago. Ryan (Bigg) do you remember what we ended up doing?
On Tue, Mar 2, 2010 at 11:53 AM, David <[email protected]> wrote: > Hi all, > > I'm new to this forum and I'm not sure I am allowed to ask you this > kind of question here. > Let me know if this is a problem. > > I'm just wondering if any of you had similar problem like I am having. > We just upgraded our Ruby(->1.9.1p376) and rails(->2.3.5). > Since it has changed the way it handles encoding, we had some problems > in handling utf-8 encoded character correctly. > However, after a few tweaks everthing seemed working just fine with > utf-8 encoding until we found this problem. > > The problem we have is although our application's default encoding is > utf-8. > When user submits a form then we get ASCII-8BIT encoded string > parameter somehow. > I believe we have set our meta tag correctly like below (it's haml) > > %meta{'http-equiv'=>"content-type", :content=>"text/html; > charset=UTF-8"} > > As far as my research goes, when subimts a form it will use the > default charset of the web page. > However, these are the encoding that I get. > > puts params[:name].encoding => ASCII-8BIT # name parameter is > submitted by the form > puts "some string".encoding => UTF-8 > puts Encoding.default_external.name => UTF-8 > > I have no idea why this is happenning. > Although I can convert it to UTF-8 by doing > params[:name].force_encoding('UTF-8'), this isn't a pretty solution. > There should be some way of fixing this or I am missing something. > I googled for the last two days, but haven't got any solution. > > Have anyone had the similar problem? > Your help will be very much appreciated. > > > Regards, > > David > > -- > You received this message because you are subscribed to the Google Groups > "Ruby or Rails Oceania" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rails-oceania?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en.
