From f5c332736d3f1945d6e9c84662d9542f34439ef2 Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Fri, 10 Nov 2023 22:16:51 -0600 Subject: [PATCH] Provide option to escape unicode in server.properties --- Dockerfile | 2 +- docs/configuration/server-properties.md | 4 ++++ scripts/start-setupServerProperties | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f8a65486..41215948 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,7 +42,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \ --var version=1.9.1 --var app=mc-server-runner --file {{.app}} \ --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz -ARG MC_HELPER_VERSION=1.36.6 +ARG MC_HELPER_VERSION=1.36.7 ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION} # used for cache busting local copy of mc-image-helper ARG MC_HELPER_REV=1 diff --git a/docs/configuration/server-properties.md b/docs/configuration/server-properties.md index ba2de8e4..a7f85247 100644 --- a/docs/configuration/server-properties.md +++ b/docs/configuration/server-properties.md @@ -24,6 +24,10 @@ renders ![](../img/motd-example.png) +!!! note "Escape unicode" + + Some Minecraft versions and server types do not support unicode characters, such as §, in `server.properties`. In those cases, an extra "\u00C2" will appear in the file and the client will render those as  characters. Unicode characters can be written as escaped codes by setting the environment variable `SERVER_PROPERTIES_ESCAPE_UNICODE` to "true". + To produce a multi-line MOTD, embed a newline character as `\n` in the string, such as -e MOTD="Line one\nLine two" diff --git a/scripts/start-setupServerProperties b/scripts/start-setupServerProperties index f0ab364c..a5e71a0c 100755 --- a/scripts/start-setupServerProperties +++ b/scripts/start-setupServerProperties @@ -110,11 +110,13 @@ function customizeServerProps { setPropertiesArgs=( --definitions "/image/property-definitions.json" + --escape-unicode="${SERVER_PROPERTIES_ESCAPE_UNICODE:-false}" ) if [[ -v CUSTOM_SERVER_PROPERTIES ]]; then setPropertiesArgs+=(--custom-properties "$CUSTOM_SERVER_PROPERTIES") fi + handleDebugMode if ! mc-image-helper set-properties "${setPropertiesArgs[@]}" "$SERVER_PROPERTIES"; then log "ERROR: failed to update server.properties" exit 1