Set -Dsun.jnu.encoding=UTF-8 in elasticsearch.in.sh #15552
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently we set
-Dfile.encoding=UTF-8
in elasticsearch.in.sh (which affects the content of a file) but not the dualsun.jnu.encoding
which affects the creation of file names. The value ofsun.jnu.encoding
is usually determined on Unix systems by theLANG
environment variable.With UTF-8 index names, this can lead to interesting issues. I have observed this first when setting up my build server as the REST test
rest-api-spec/src/main/resources/rest-api-spec/test/index/10_with_id.yaml
failed. This test creates an index with nametest-weird-index-中文
.To reproduce:
JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8"
toJAVA_OPTS="$JAVA_OPTS -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=ANSI_X3.4-1968"
curl -XPOST localhost:9200/test-weird-index-中文