PostgreSQL: create database with UTF8 encoding same as in MySQL (including character set, encoding, and lc_type)

Yes, you can be more specific. For example: CREATE DATABASE “scratch” WITH OWNER “postgres” ENCODING ‘UTF8’ LC_COLLATE = ‘en_US.UTF-8’ LC_CTYPE = ‘en_US.UTF-8’; Also I recommend to read the following pages about locales and collations in PostgreSQL: http://www.postgresql.org/docs/current/interactive/locale.html http://www.postgresql.org/docs/current/interactive/collation.html

The difference between InputStream and InputStreamReader when reading multi-byte characters

An InputStream reads raw octet (8 bit) data. In Java, the byte type is equivalent to the char type in C. In C, this type can be used to represent character data or binary data. In Java, the char type shares greater similarities with the C wchar_t type. An InputStreamReader then will transform data from … Read more

Are all JSON objects also valid JavaScript objects?

Update 2019: the answer is now YES as of this proposal and JavaScript versions following ECMAScript 2019 (including) will be proper supersets. TL;DR The answer is “no”. There are cases when JSON object won’t be valid for JavaScript. JSON is NOT a JavaScript subset. “Little” difference JSON That is: due to JSON specification, you can … Read more

A good way to get the charset/encoding of an HTTP response in Python

To parse http header you could use cgi.parse_header(): _, params = cgi.parse_header(‘text/html; charset=utf-8’) print params[‘charset’] # -> utf-8 Or using the response object: response = urllib2.urlopen(‘http://example.com’) response_encoding = response.headers.getparam(‘charset’) # or in Python 3: response.headers.get_content_charset(default) In general the server may lie about the encoding or do not report it at all (the default depends on … Read more

How to get UTF-8 in Node.js?

Hook into you response generator or create a middleware that does the following: res.setHeader(“Content-Type”, “application/json; charset=utf-8”); Otherwise the browser displays the content in it’s favorite encoding. If this doesn’t help you DB is probably in the wrong encoding. For older node.js versions use: res.header(“Content-Type”, “application/json; charset=utf-8”);

Configure GPG for Git on Windows

Update Oct. 2018, as commented below by PHPirate: λ git –version git version 2.19.1.windows.1 λ gpg –version gpg (GnuPG) 2.2.9-unknown libgcrypt 1.8.3 Copyright (C) 2018 Free Software Foundation, Inc. No trace of that update in git-for-windows/git/releases Original answer (2017): By default, Git for Windows includes a gpg1, not gpg2 vonc@bvonc MINGW64 ~/.ssh $ gpg –version … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)