search for: force_encod

Displaying 18 results from an estimated 18 matches for "force_encod".

2010 Apr 19
10
Overview of Ruby 1.9 encoding problem tickets
...d for input (db, Rack, ERB, Haml, ...) in a given environment. With a optimal setup (db encoding, Ruby encoding, Rack encoding settings, I18n translations, ...), no transcoding will occur during the rendering process, no matter what the default Rails encoding is used (including ASCII_8BIT), and no force_encoding would be needed internally in Rails, except as workarounds for gems and libraries where this is difficult otherwise. The guideline for gem and plugin developers would be: do not create or return strings (other than internal use) that are not compatible with the default encoding both ways. In s...
2010 Sep 01
4
NoMethodError: undefined method `force_encoding' for "Conten
....................................................................................................................................................................................EEEE.EE... Finished in 1.068686 seconds. 1) Error: test_post_multipart(FormsMechTest): NoMethodError: undefined method `force_encoding'' for "Content-Disposition: form-data; name=\"first_name\"\r\n\r\n\r\n":String ./lib/mechanize/form.rb:229:in `request_data'' ./lib/mechanize/form.rb:229:in `collect'' ./lib/mechanize/form.rb:229:in `request_data'' ./lib/mechani...
2009 Aug 02
2
win32-security, 1.9.x, encoding issue?
Hi, Windows Vista Home Premium ruby 1.9.2dev (2009-07-18 trunk 24186) [i386-mswin32_90] I noticed there was an ordinal bug in win32-security and Ruby 1.9.x. I fixed those easily enough, but now we''re left with this: 1) Error: test_string_to_sid(TC_Win32_Security_Sid): ArgumentError: invalid byte sequence in US-ASCII
2011 Jun 17
7
Encoding
...hat''s a good solution for fixing character encoding problems for compatibility between ascii and utf-8? The database is postgres and is encoded in utf-8. Once in awhile there will be a compatibility error from strings from a webform. Is there a command to fix this besides using a_string.force_encoding(''utf-8'')? Even this doesn''t seem to always work either. Thanks, Erica -- 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-/JYPxA39Uh5TLH3MbocFF+G/...
2009 Mar 21
15
mysql encoding with rails 2.3.2 and ruby 1.9.1
when I run console with ruby 1.9.1 and rails 2.3.2, and trying to do something like User.first.name.encoding I''m getting #<Encoding:ASCII-8BIT>, though I''ve set "encoding: utf8" in database.yml any suggestions? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails:
2011 Mar 02
2
[ win32utils-Bugs-28904 ] Gem win32-eventlog v0.5.2 on Ruby 1.9.1 and 1.9.2
...og.rb Wed Mar 02 15:51:40 2011 +++ \Users\bjansen\Development\eventlog.rb Wed Mar 02 15:51:25 2011 @@ -11,6 +11,9 @@ # Return the portion of the string up to the first NULL character. This # was added for both speed and convenience. def nstrip + if !self.ascii_only? + self.force_encoding($>.external_encoding || Encoding.default_external) + end self[ /^[^\0]*/ ] end end ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=411&aid=28904&group_id=85
2011 Jan 23
1
Force UTF-8 encoding
...m writing an upload script for contact management, but having encoding issues: #=> Encoding::UndefinedConversionError: "\xFA" from ASCII-8BIT to UTF-8 I will not always know the encoding supplied, and this is the result of `some_string.encode("UTF-8")` I have also tried .force_encoding("UTF-8") to no avail. For now I''m simply trying to bypass invalid characters by replacing them with ? or removing them completely so Postgres doesn''t blow up on insert. Any help or advice would be appreciated, Garrett Lancaster -- You received this message becau...
2009 May 21
2
PuppetShow undefined methods problems..
I get these stack traces after setting up puppetshow and browsing the gui at http://site:3000/ http://pastebin.com/m459851f6 Any ideas? Im using 0.24.5 with rails 2.0.2 on a debian 5.0.1.. /flash --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to
2010 Dec 05
3
Strange problem with CSV and funny chars
I am using CSV in a rake task (db:seed) on Rails 3.0.3, Ruby 1.9.2 to read a file with some funny chars in it. Upon breaking in at a point where the row read using CSV is in variable row, with the string with the char in row[''price''] I get the following strange results which I cannot understand. (rdb:1) row[''price''] "\xA32.00" (rdb:1)
2010 Jul 01
25
Encoding problems with Rails 3 + Ruby 1.9.1 (big surprise)
...ut that doesn''t appear to affect templates at all. The problem, so far as I can see, is in one of two places: I either need to tell Rack to make all my string parameters encoded in UTF-8 or I need to set my template default encoding to UTF-8. A quick fix is: params[:form].each { |k, v| v.force_encoding ''UTF-8'' if v.is_a? String } I know this is not ideal, but I don''t understand how the view works well enough to do this better. What should I do to fix this problem? (Oh, and I''m using ERB, as an FYI.) -- You received this message because you are subscribed...
2009 Apr 12
9
invalid byte sequence utf-8 OR best option to sanitize content brought in with net::http? single non-utf character causes rails to crash
...aracters that are not utf-8 compliant that probably riddle my sql server database because users like to cut and paste content from word and other places. it turns out that because the content that i bring in via ruby net::http has non-utf8 characters, the encoding is set to ascii8bit and when i do force_encoding(utf-8), valid_encoding is false and the page just fails. html::sanitize isn''t an option as i don''t want to strip the tags. the content is from internal trusted servers that i control. i just need to sanizite, i guess, the bad characters. my thoughts/questions: 1) seems like ra...
2014 May 18
0
Problem on reading a web page (no matter using Net:HTTP or nokogiri)
Currently I am trying to get some reference data from bet.hkjc.com/football/index.aspx?lang=ch&pageno=1 However, I could not read the content (page source) properly even though I used force_encoding or String.encode! after getting the response.body Same coding is working fine for other site, but just this site has some tricky things made ruby cannot read the page content correctly. Do anyone has idea on this? -- Posted via http://www.ruby-forum.com/. -- You received this message becau...
2014 Nov 19
0
incompatible character encodings: ASCII-8BIT and UTF-8
Hi, I have problem with showing some string in my site with Rails 4 I get this message: incompatible character encodings: ASCII-8BIT and UTF-8 concerning this html sequence in an erb file: <h3><%= MyString.to_s.force_encoding("UTF-8") %></h3> I get this problem only on *production server,* but I do not have the problem on my local computer What can I do with this problem regards, -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group...
2012 Feb 07
10
Encoding error
Hello, I have in my db a register what have special characters, and when I try to put on my form to edit this values, this happens: incompatible character encodings: UTF-8 and ASCII-8BIT Extracted source (around line #4): 1: <%= form_for :group, :url => { :action => "update" } do |f| %> 2: <%= utf8_enforcer_tag %> 3: <label>Nome do grupo</label>
2010 Dec 10
0
Encoding issues when uploading files
...brick/httpserver.rb:70:in `run'' /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'' I''m able to make a workaround like this: def create # force encoding of the original filename to utf-8 params[:gallery_image] [:image].original_filename.force_encoding(''utf-8'') @image = GalleryImage.create(params[:gallery_image]) redirect_to ''/'' + @image.document.url.url end But I don''t think it''s supposed to be like this. Shouldn''t rack take care of this for me ? Thanks for contributi...
2011 Aug 29
32
Weird assignment problem, very confused :(
Hey, I have the following line in my controller: User.create(:email => "fuuu-+RB1Aph5k6s@public.gmane.org", :password => ''asldfkjadsfadsf'', :ip => request.remote_ip) my IP is 127.0.0.1 - now User.find_by_ip(''127.0.0.1'') returns 0 records although User.first contains ''127.0.0.1'' if I change it to: User.create(:email =>
2009 Nov 13
3
Encoding::UTF_8 missing?
I''ve just done a fresh reinstall of OS X Snow Leopard on my mac, and I''m having all kinds of problems with Rails, but the latest problem has me stumped. Whenever I run rake db:seed to populate my database I hit the following error: ** Invoke db:seed (first_time) ** Invoke environment (first_time) ** Execute environment ** Execute db:seed rake aborted! uninitialized constant
2011 Oct 26
8
IronRuby's Marshal.dump doesn't work with CLR types, or ruby types backed by a CLR type
Backstory: I''m trying to use DRb for some in-house utility code. DRb itself seems to work fine, but I found that when I misspelled a method name, instead of reporting back a NoMethodError, the IronRuby process crashed immediately to the console. This is using a relatively recent build of IronRuby from Github Steps to repro: e = RuntimeError.new ''xyz'' dumped =