Special characters in ruby - ruby-on-rails

Can any one suggest me any gem or a way to solve the special characters issue occurring in ruby 1.8.7 and rails 3.2.13.
I want to replace the special characters instead of removing.
I have tired using iconv gem. It works for some special characters alone.
Thanks..

Related

How can I setup correctly Rails project?

I have installed Ruby Version 3.1.2p20 and Rails Version Rails 7.0.4.
So I want to create new rails app and when I type rails new test-app I am getting error related to UTF-8. Does anyone has any recommendation or can help me setup Rails app correctly? Thanks in advance.
I tried many solutions, but I am thinking I should reinstall it all. Also I checked PATH and it is correctly added.
I am not exactly sure what is the issue here with Ruby 3.1 in windows. But as we know that Ruby's default encoding since 2.0 is UTF-8. This means that Ruby will treat any string as a UTF-8 encoded string unless you tell it explicitly that it's encoded differently so I am guessing there might be something wrong in pathname.rb file.
I faced the same issue in windows and I resolved it by downgrading ruby from 3.1 to 2.7 and it worked for me.

incompatible character encodings utf-8 and windows-1251, installing ruby, ruby on rails

I don't know much about this stuff, help me, please. I was installing ruby railsinstaller-windows
on step 9 there was a problem
What should I do? I need a good explanation.
I guess that happens because the path where you are installing Ruby, contains non-ASCII characters (i.e. your username, try to rename it).

Ruby 1.9.3 encoding

I was using ruby 1.8.7 and rails 3.2.11 for more than year and I developed my application using it, when I upgraded my ruby version to 1.9.3 these issue raised
incompatible character encodings: UTF-8 and ASCII-8BIT on my application.js file
I tried many solutions but all fails any body can help me ?
In Ruby 1.8, strings weren't encoded. In 1.9.3, you need to say what character set encoding your string is using. The default is ASCII, which is a problem, as you can't add differently encoded strings together.
For more information, look here:
http://blog.grayproductions.net/articles/ruby_19s_string
To fix it, make sure your strings and files are all using UTF 8 (or whatever you want) encoding, and your database has the right types.

Does jruby 1.6.3 in 1.9.2 compatibility mode works with rails 2.3.11? Meaning did somebody tried that?

We are using jruby 1.6.x and we would like to switch to 1.9 mode because of UTF8 support. However, we don't want to upgrade rails from 2.3.8/2.3.11 to rails 3.
I tried to upgrade a Rails 2.3 application first to ruby 1.9.3. There were all kind of utf8-related problems. Some of them you can fix easily, by putting a utf8 header in the file, but some of the problems occur only in special conditions, for example when an error message is constructed from different parts somewhere deep in the rails stack, an one part was ascii, the other utf8.
When I investigated the problems I found other have also different kind of utf8 problems.
So it easier to go first to rails 3.0 and then to ruby 1.9

I have a new Rails 3 app on ruby 1.8.7, what's the impact of moving to 1.9?

I'm newish to rails, and I started with rails 3 and ruby 1.8.7
I'm not sure exactly why I went with 1.8.7, but I think it was because many gems are not supported with 1.9.
Was my analysis wrong and I can move to 1.9?
What are things to consider moving to 1.9? Is rails 3 ready for it?
I've moved to 1.9.2 about two months ago and so far everything seems OK. 1.9 is largely backwards-compatible so most things are not a problem.
That said there are two possible sources of significant annoyance when going to 1.9:
CSV parsing. Ruby switched internally to FasterCSV but doing require 'fastercsv' will result in an error. This will require changes to your code if you are doing any CSV parsing.
Encoding changes. If your code (not data) includes non-ascii characters your app will fall apart. The fix is not hard, you have to put the magic comment # encoding: utf-8 on top of any such files, but again a possible source of pain.
All gems I've been using work fine (except those doing CSV).
The only real way to find out for your application is to use rvm and install 1.9.2. Upgrade all of your gems using Bundler and then run all of your tests. Manual testing of the application will ferret out any remaining issues that are not common and specific to your code and data.

Resources