Non-ASCII characters are corrupted when importing properties content with the env: prefix
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 82/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- java, spring-boot
- Área
- backend
Línea de trabajo
Empieza en SystemEnvironmentConfigDataResource#load, donde el issue indica que la cadena de la variable de entorno se codifica como UTF-8 antes de pasarla al cargador de properties. Lee las pruebas relacionadas de SystemEnvironmentConfigData* y añade cobertura para contenido de properties con caracteres no ASCII importado con el prefijo env:. Se considera terminado cuando el valor importado conserva los caracteres originales sin requerir una indicación de codificación.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
SystemEnvironmentConfigDataResource turns the environment variable value into bytes with content.getBytes(StandardCharsets.UTF_8), but then calls loader.load(name, resource, this.encoding) with encoding == null unless the [encoding=...] hint is used. OriginTrackedPropertiesLoader then decodes with its default ISO-8859-1, so any non-ASCII character in a .properties-style variable is corrupted.
Since the environment variable is already a String, there is no file encoding involved, and the bytes Spring Boot produces itself are always UTF-8.
Spring Boot 4.1.2
MY_CONF='greeting=Grüße' java -jar app.jar --spring.config.import=env:MY_CONF
environment.getProperty("greeting") -> "Grüße" (expected "Grüße")
The same content imported as YAML (env:MY_CONF[.yaml]) is read correctly. Adding [encoding=utf-8] works around the problem, but users have no reason to expect they need it for an in-memory string.
Possible fix: in SystemEnvironmentConfigDataResource#load, default to the charset the content was encoded with:
private Charset getEncoding() {
return (this.encoding != null) ? this.encoding : StandardCharsets.UTF_8;
}
I verified this end to end: I ran the packaged app as a separate process with the variable set and read the value over HTTP. With 4.1.2 the bytes are 47 72 c3 83 c2 bc .... With a locally built spring-boot jar including the change above, the result is Grüße (47 72 c3 bc c3 9f 65). The existing SystemEnvironmentConfigData* tests still pass. I'm happy to submit a PR with a test.
- Lenguaje dominante
- Java
- Estrellas
- 81.8k
- Forks
- 43.5k
- Merge medio
- 3 d 13 h
- PR fusionados (30 d)
- 90
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de spring-projects/spring-boot
-
status: waiting-for-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
spring-projects/spring-boot#52651 ·
Los mantenedores suelen responder en 2 días
-
JavaLoggingSystem.getLoggerConfiguration does not map ROOT and creates unknown loggers on lookupAbiertostatus: waiting-for-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
spring-projects/spring-boot#52646 ·
Los mantenedores suelen responder en 2 días
-
Maven process-test-aot only copies META-INF/native-image of the generated resources so the Logback configuration is lost in native testsPosiblemente ocupada @tchowdhury101 la tomó hace 4 días. Abiertotype: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
spring-projects/spring-boot#52301 · 4 comentarios ·
Los mantenedores suelen responder en 2 días
-
for: team-meeting status: waiting-for-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
spring-projects/spring-boot#52295 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 2 días
-
Add a How-To to explain how to configure logging of AOT processingQuizá libre de nuevo @dana-stc la tomó hace 30 días y no hay ningún pull request abierto. Abiertostatus: team-only type: documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
spring-projects/spring-boot#52092 · 1 comentario ·
Los mantenedores suelen responder en 2 días
Todos los issues de spring-projects/spring-boot
Issues similares
-
hermes-queue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
chrisalunlloyd2-sudo/mindpalace#349 ·
Los mantenedores suelen responder en 1 día
-
bug priority: medium Review effort [1-5]: 2 status: needs-triage type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
carlos-emr/carlos#5818 ·
Los mantenedores suelen responder en 1 día
-
bug good first issue help wanted tooling
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
appmonster007/kmip-adapter#100 ·
-
[Documentation]: Remove non-existent CHANGELOG reference from StateBackendProperties JavadocAbiertoaccepted good first issue java
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Marketplace time-zone issueAbiertobug main ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
openhab/openhab-webui#4671 ·
Los mantenedores suelen responder en 1 día