Chinese garbled solution
cmd can not be entered in Chinese
Change the CMD code page to 936:
Ruby read Chinese force set to Utf-8
You can add a comment statement to a file # Encoding:utf-8,ruby will be loaded in UTF-8 format
CMD output garbled
This is not going to work out, I see someone using a third-party library to solve the output
Require ' iconv '
cov = iconv.new (' GBK ', ' utf-8 ')
puts Cov.iconv ("Beijing Olympic Games!")
Ps:ruby program, it is best not to appear in Chinese, except notes
Solve Ruby's problem of not supporting OpenSSL
when Rhel 5.4 x86_64 installs rails, it prompts Ruby not to support OpenSSL
Entering the $ruby_home/ext/openssl directory, performing RUBY exconf.rb, the following error occurred:
= = OpenSSL for Ruby Configurator = = =
= = = = Checking for system dependent stuff ... = =
Checking for T_open () in-lns L... No
checking for socket () In-lsocket ... no checking for
assert.h ... yes
= = Checking for required ... = =
Checking for openssl/ssl.h ... no
= = Checking for required stuff failed. = =
Makefile wasn ' t created. Fix the errors above.
Hint did not find ssl.h, downloaded from http://www.openssl.org/openssl-0.9.8k.tar.gz. Extract, perform configure && make && make install. Go back to $ruby_home/ext/openssl and do it again
Ruby Extconf.rb--with-openssl-include=/usr/local/ssl/include/--with-openssl-lib=/usr/local/ssl/lib
Success. But then a new error occurs when you execute make:
~/sources/ruby-1.8.7-p174/ext/openssl$ sudo make gcc-shared-o openssl.so ossl_x509.o ossl_x509cert.o ossl_x509crl.o os SL_PKCS7.O ossl_cipher.o ossl_pkey_dh.o ossl_ssl_session.o ossl_x509attr.o ossl_x509ext.o ossl_ocsp.o ossl_asn1.o Ossl _X509NAME.O ossl_x509revoked.o ossl_rand.o ossl_pkcs12.o ossl_x509store.o ossl_ssl.o ossl.o ossl_digest.o ossl_ CONFIG.O ossl_pkcs5.o ossl_bio.o ossl_pkey_dsa.o ossl_pkey.o ossl_x509req.o ossl_pkey_ec.o ossl_hmac.o openssl_ MISSING.O ossl_ns_spki.o ossl_pkey_rsa.o ossl_engine.o ossl_bn.o-l.-l/usr/local/ruby/lib-wl,-r/usr/local/ruby/lib-
L/usr/local/ssl/lib-wl,-r/usr/local/ssl/lib-l.-RDYNAMIC-WL,-EXPORT-DYNAMIC-LSSL-LCRYPTO-LRT-LDL-LCRYPT-LM-LC /USR/BIN/LD:/usr/local/ssl/lib/libssl.a (S2_METH.O): Relocation r_x86_64_32 against ' a local symbol ' can is not used WH En making a shared object;
Recompile with-fpic/usr/local/ssl/lib/libssl.a:could not read Symbols:bad value Collect2:ld returned 1 exit status Make: * * * * [openssl.so] Error 1
Prompts you to retry the compilation of OpenSSL with the-fpic parameter. So recompile OpenSSL