Source: https://stackoverflow.com/questions/20694317/json-encode-function-special-characters.pdf