Fix RuntimeError: Invalid NLS_LANG Format: AMERICAN

I am trying to hit Oracle from Ruby and get an error on the first line. (I'm actually doing this ok, but it probably doesn't matter.)

[1] pry(main)> require 'oci8'
RuntimeError: Invalid NLS_LANG format: AMERICAN

      

What is the problem and how can I fix it?

The error message showed nothing promising. (This is the question now ). The only other question similar to this one on stackoverflow deals with a different problem (a variable having no value at all even if the user set it) and the answer didn't work for me (the suggested value is also invalid and $LANG

not set in my environment, so installing it on it didn't work.)

+3


source to share


2 answers


NLS_LANG

should be in the format <language>_<territory>.<characterset>

Right from the doc, there is an example that matches your specific use case:

The NLS_LANG environment variable is set as a local environment variable for the shell on all UNIX-based platforms. For example, if the operating system locale parameter is en_US.UTF-8, then the corresponding NLS_LANG environment variable must be set to AMERICAN_AMERICA.AL32UTF8 .



Note: AL32UTF8

is a superset UTF8

(no hyphen) that accepts all Unicode characters. UTF8

only supports Unicode 3.1 and earlier. I would highly recommend using AL32UTF8

"UTF-8" as the default character set unless you have special needs.

Oracle 12.1 AL32UTF8

supports Unicode up to 6.1. One of the advantages is AL32UTF8

support for additional characters introduced by Unicode 4.0 (codes from U + 10000 to U + 10FFFF)

+3


source


I don't know where the "AMERICAN" value came from, but it turns out that the best option that the ruby-oci8 pearl will accept is NLS_LANG=AMERICAN_AMERICA.UTF8

.



+1


source







All Articles