Postgres issue encoding “UTF8” has no equivalent in encoding “LATIN1”

As guessed, the problem was with the client_encoding on the database. crd_production=# show client_encoding; client_encoding —————– LATIN1 (1 row) To change the client encoding to UTF-8, you need to do this crd_production=# SET client_encoding = ‘UTF8’; SET Check again crd_production=# show client_encoding; client_encoding —————– UTF8 (1 row) Things work fine now.

encoding of file shell script

I’d just use file -bi myfile.txt to determine the character encoding of a particular file. A solution with an external dependency but I suspect file is very common nowadays among all semi-modern distro’s. EDIT: As a response to Laurence Gonsalves’ comment: b is the option to be ‘brief’ (not include the filename) and i is … Read more

Base64 Encode String in VBScript

I was originally using some VBScript code from Antonin Foller: Base64 Encode VBS Function and Base64 Decode VBS Function. Searching Antonin’s site, I saw he had some code for quoted printable encoding, using the CDO.Message object, so I tried that. Finally, I ported the code mentioned in Mark’s answer to VBScript (also used some code … Read more

application/x-www-form-urlencoded and charset=”utf-8″?

There is no charset parameter defined for this media type. For the encoding guidelines, see https://url.spec.whatwg.org/#application/x-www-form-urlencoded . The application/x-www-form-urlencoded standard implies UTF-8 and percent-encoding. Though: A legacy server-oriented implementation might have to support encodings other than UTF-8 as well as have special logic for tuples of which the name is _charset. Such logic is not … Read more

How to specify output file encoding in Ruby?

Here’s an example that outputs a file in the UTF-16LE encoding: open(“data.txt”, “w:UTF-16LE”) Ruby looks at the encoding of the string you are writing, and transcodes as necessary. Here’s a very detailed blog post describing mechanics with excellent examples (see the section called “The Default External and Internal Encodings”).

How to convert UTF-8 std::string to UTF-16 std::wstring?

This is how you do it with C++11: std::string str = “your string in utf8”; std::wstring_convert<std::codecvt_utf8_utf16<char16_t>> converter; std::wstring wstr = converter.from_bytes(str); And these are the headers you need: #include <iostream> #include <string> #include <locale> #include <codecvt> A more complete example available here: http://en.cppreference.com/w/cpp/locale/wstring_convert/from_bytes

A url resource that is a dot (%2E)

It’s actually not really clearly stated in the standard (RFC 3986) whether a percent-encoded version of . or .. is supposed to have the same this-folder/up-a-folder meaning as the unescaped version. Section 3.3 only talks about “The path segments . and ..”, without clarifying whether they match . and .. before or after pct-encoding. Personally … Read more