### CI Link

https://gradle-enterprise.elastic.co/s/323cgxy7itfky

### Repro line

REPRODUCE WITH: ./gradlew ':server:test' --tests "org.elasticsearch.common.StringsTests.testDeleteAny" -Dtests.seed=8A64C9DD086550D3 -Dtests.locale=it -Dtests.timezone=Asia/Baghdad -Druntime.java=17	

### Does it reproduce?

Yes

### Applicable branches

main

### Failure history

https://gradle-enterprise.elastic.co/scans/tests?search.timeZoneId=Europe/Rome&tests.container=org.elasticsearch.common.StringsTests&tests.test=testDeleteAny

### Failure excerpt

```
java.lang.AssertionError: |  
  | Expected: "짞ĐGⰣ*ﮢ" |  
  | but: was "짞ĐGⰣﮢ"
```
server/src/test/java/org/elasticsearch/common/StringsTests.java
public void testSpaceify() throws Exception {
        String[] lines = new String[] { randomAlphaOfLength(5), randomAlphaOfLength(5), randomAlphaOfLength(5) };
        
        StringBuilder sb = new StringBuilder();
        spaceify(4, String.join("\n", lines), sb);
        assertThat(sb.toString(), equalTo(Arrays.stream(lines).map(s -> " ".repeat(4) + s).collect(Collectors.joining("\n", "", "\n"))));
        sb = new StringBuilder();
        spaceify(0, String.join("\n", lines), sb);
        assertThat(sb.toString(), equalTo(Arrays.stream(lines).collect(Collectors.joining("\n", "", "\n"))));
    }
    public void testHasLength() {
        assertFalse(hasLength((String) null));
        assertFalse(hasLength(""));
        assertTrue(hasLength(" "));
        assertTrue(hasLength("Hello"));
        assertTrue(hasLength("\0"));
    }
    public void testIsEmpty() {
        assertTrue(isEmpty(null));
        assertTrue(isEmpty(""));
        assertFalse(isEmpty(" "));
        assertFalse(isEmpty("Hello"));
        assertFalse(isEmpty("\0"));
    }
    public void testHasText() {