So I'm using Docker to run a Rails app which uses Sequel to connect to Snowflake via ODBC (snowflake-odbc-2.22.4.x86_64.deb
). I'm able to connect to my Snowflake instance and query tables fine, but I'm currently running into an issue where any special characters is return \x1A
instead of the character.
For example, if in Snowflake I have this table (User
):
|fname|
|-|
|яйяйяй|
Running this query in Rails:
SELECT fname FROM User
returns
[{
:fname => "\x1A\x1A\x1A\x1A\x1A\x1A"
}]
where there's 1 \x1A
for each special character
Doing data[:fname].encoding
returns ASCII-8BIT
and data[:fname].force_encoding('UTF-8')
returns an empty string.
I did a similar query with python and the snowflake connector, and it worked fine, so this makes me think there might be an issue with my sequel configuration and reading/saving the response from Snowflake.
I tried add :encoding => "utf8"
to my Sequel.odbc(:drvconnect=> SNOWFLAKE_CONN_STR, :encoding => "utf8")
but that didn't change anything.
Thanks in advance!
Try to set below env variables:
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US.UTF-8
We have this in Dockerfile.