I have a Ruby 1.9.2 install on Centos 5.5. Every time I install a gem, I get the error
ERROR: While generating documentation for (gem)
... MESSAGE: U+2018 from UTF-8 to US-ASCII
... RDOC args: lib History.txt README.txt
The gem still installs ok, but there are certain things I can't do. Like use SproutCore, for example. I get this little gem (pun intended).
sc-init xxxx
~ Created directory at xxxx
FATAL ~ invalid byte sequence in US-ASCII
Anyone have any idea what's going on, and how to remedy it? Google isn't much help on this one.
RDoc updated last week, and was supposed to help fix encoding problems.
Try gem update rdoc and see if that helps.
Related
I uninstalled Ruby 1.9.3 and installed Ruby 2.0, went and installed the rest-open-uri gem since one of the scripts that I wrote used that gem, but this error occurs when I try to run it
E:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require': E:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rest-open-uri-1.0.0/lib/rest-open-uri.rb:413: invalid multibyte escape: /[\r\n\t !#-[]-~\x80-\xff]+|(\[\x00-\x7f])/ (SyntaxError)
Why does this happen? I'm not entirely sure if it's due to me using a newer version of Ruby. The gem was released in 2006 so it is probably outdated and no longer supported.
Other scripts that I have use RestClient, which does not have this problem, so if the best solution is to just drop the outdated libraries and move to newer ones that is probably what I'll do.
One of the differences between ruby 1.9 and ruby 2.0 is that the default encoding is now utf-8. To fix this issue you should edit the file E:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/rest-open-uri-1.0.0/lib/rest-open-uri.rb, and add the first line:
# encoding: US-ASCII
see here for more details
I cannot find Ruby-opencv 0.0.10 API manual on the web. On the web, I just find version 0.0.7 document, it seems out of date.
Then I try to create rdoc myself, but gem rdoc ruby-opencv cannot work.
gem rdoc ruby-opencv
Parsing documentation for ruby-opencv-0.0.10
unable to convert "\xE0" from ASCII-8BIT to UTF-8 for lib/opencv.so, skipping
How to solve it? Any suggestion is welcome, thanks in advance.
I finally find a way to get the API doc. It's quiet simple.
Just go to the source files dirctory of gem Ruby-opencv, then run rdoc there.
In myown machine, it's as following
cd /home/uncutstone/.rvm/gems/ruby-2.0.0-p353/gems/ruby-opencv-0.0.10/ext
rdoc --ri
I'm trying to install the mysql2 gem on Windows 8 (Ruby 1.9.3 and Rails 4.0.1). I've installed the Devkit and it's working properly, and I'm entering the following:
gem install mysql2 --platform=ruby -- '--with-mysql-lib="C:\mysql-connector\lib" --with-mysql-include="C:\mysql-connector\include" --with-mysql-dir="C:\mysql-conector"'
I've done this before and it's worked, but for some reason this time it's throwing this bizarre message:
Cannot find include dir at C:\mysql-connector\include;C:\mysql-connector\include;C:\mysql-connector/include;
This is of course in addition to the whole "Could not create makefile for some reason..." message. I'm using the mysql connector that I found through a different post here--Ruby MYSQL2 gem installation on windows 7
Does anyone know how I can fix this? I really need this gem...
I figured this out...
All I had to do was:
gem install mysql2 --platform=ruby -- '--with-mysql-dir="C:\mysql-connector\"'
Strange though--last time it worked with the code above... Go figure...
I just ran into the exact same issue trying to install mysql2 0.3.14 on Window 64bit, Rails 3.2.15 and Ruby 2.0.0p247. I used a command very simliar to what user2986379 posted and it worked; literally 5 minutes later when I had to rerun the command to fix another issue it stopped working. I was even copying the command from notepad each time so there wasn't a typo. Odd.
Anyway, user2986379's solution of adding quotes to the paths helped me get past the issue, but I was still getting some errors. I ended up modifying the command by removing the single quotes. In case anyone needs it, here's the command I ran:
gem install mysql2 --platform=ruby -- --with-mysql-dir="C:\mysql-connector"
Lastly, just for completeness, I had to use the version of connector c located here. You can read more about why this is necessary at the bottom of https://github.com/brianmario/mysql2/issues/372. It will install fine, but without the special connector_c you might get a segmentation fault when you go to actually use the gem. (Don't forget to grab the libmysql.dll out of that special connector c zip file as well and place it in your ruby bin directory.)
I compiled ruby 1.9.3-p134 from source on RedHat RHEL 5.2.
Everything went smoothly except two things.
1
When trying to run ruby from the command line it said not found in /usr/bin/ruby, but which ruby pointed to /usr/local/bin/ruby. So i created a softlink ln -s /usr/local/bin/ruby /usr/bin/ruby, however ...
2
gem gives me the following error:
$ gem
/usr/local/lib/ruby/1.9.1/rubygems/version.rb:191:in `strip!': can't modify frozen String (RuntimeError)
from /usr/local/lib/ruby/1.9.1/rubygems/version.rb:191:in `initialize'
from /usr/bin/gem:14:in `new'
from /usr/bin/gem:14:in `<main>'
No luck googling since "can't modify frozen String" is a common ruby error.
Any help would be appreciated.
I might have had conflicting gem installs.
find / -name gem 2>/dev/null
/home/muradan/install_ruby/ruby-1.9.3-p194/bin/gem
/usr/lib64/ruby/gems/1.8/gems/rubygems-update-1.3.6/bin/gem
/usr/share/locale/gem
/usr/bin/gem <----- which gem, doesn't work
/usr/local/bin/gem <----- works
So I deleted and softlinked it to /usr/local/bin/gem.
Now I got problems with other gem stuff like gemlocks (which doesn't exist in /usr/local/bin or anywhere else except the non working /usr/bin)
UGH!! Why isn't linux consistent! what's the point of application installing to /usr/bin and some to /usr/local/bin with no rhyme or reason!
FML
guys. I am developing a Chinese application with rails. Now I want to input some Chinese characters in rails console but cannot do that, either in irb.
Any guys who have the experience to solve this problem? I would appreciate your help!
Based on #Jimmy-Huang's answer, these are the steps I followed on Mac Leopard using rvm and ruby 1.9.2:
rvm package install readline
rvm remove 1.9.2
rvm install 1.9.2 --with-readline-dir=$rvm_path/usr
That resulted in some errors, particularly when trying bundle install:
uninitialized constant Gem::SilentUI
It turned out that's due to an older version of bundler and this gets rid of it:
gem install bundler
I found the solution for me, it need to re-compile the readline. And now I can input non-ASCII characters!
Because I am using rvm, so I found this article to teach you how to re-compile readline under rvm. http://rvm.beginrescueend.com/packages/readline/
And for someone who is not using rvm, maybe you can follow this post and have a try:
http://henrik.nyh.se/2008/03/irb-readline
By the way, ruby-1.9.2 irb already supports non-ASCII inputing.
Check out the pack method on array:
http://ruby-doc.org/core-1.8.7/classes/Array.html#M000287
I think you'd want:
[111 ,222, 333].pack(U*)
Here is an interesting discussion on the subject had with Matz:
http://www.ruby-forum.com/topic/134919