Skip to content
Advertisement

Snowflake unable to display / interpret unicode ‘u0089’

I am trying to show Unicode character ‘u0089’ in the snowflake browser results, however it seems to be showing a default error value instead. I’m lost as to how to fix this issue

The data is being ingested from a source JSON doc which states the field to be

"Units": "u0089"

enter image description here

As you can see, "Units": "u0089" is not displaying correctly as ‰

One thing that is strange, is when removing the char() method. I’ve tried another code 137, however when trying to covert back as a unicode it is incorrect

enter image description here

Any ideas? Thanks!

Advertisement

Answer

Looking at Mark’s comment – you can do this with a Java UDF:

create or replace function encode_decode_windows(s string)
returns string
language java
handler='MyClass.doit'
as
$$

    class MyClass {
        public static String doit(String s) throws Exception {
            return new String(s.getBytes("ISO-8859-1"), "Windows-1252");
        }
    }
$$;

Then to encode and decode to get a mile sign:

select encode_decode_windows('u0089');

‰
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement