Hex to unicode
更新日期:
文章目录
Sometimes, we need to read data from old-fashioned devise. Unfortunately, many old-fashioned devise doesn’t support unicode very well. So we need to translate data from any format to unicode.
Now things become clear that the string returned by ldap API is hex rather than Unicode. We need to format these string to utf-8 before taking any advantage of them.
There are mainly two ways to use ldap result:
- show the ldap result on web client
- store the ldap result to elasticsearch
I write a common function to finish the formatting work and here is its definition:
You can use the function to format every ldap result with the usage of Format::String.format_json_to_unicode(source)

