Google Cloud Messaging displays special characters wrong

Solution 1:

The solution was to set the build environment variables as flag with the deploy command:

$ gcloud functions deploy my-function ... --set-build-env-vars=JAVA_TOOL_OPTIONS=-Dfile.encoding="UTF-8"

I still don't understand why this is necessary if the default charset is also UTF-8 without that command flag.