aws / aws/aws-lambda-base-images

In the amazon/aws-lambda-ruby:3.3 Docker image, a non-existent locale is set for LANG, causing the default encoding of Ruby strings to become US-ASCII

Abierto
#167 0 comentarios 10 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Sin datos de lenguaje
Estrellas
777
Forks
118
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

In the amazon/aws-lambda-ruby:3.3 Docker image, a non-existent locale is set for LANG, causing the default encoding of Ruby strings to become US-ASCII. Is this intentional?

### The behavior in the 2.7 image

```
% docker run --rm -it --entrypoint sh amazon/aws-lambda-ruby:2.7
sh-4.2# ruby -e 'p "string_value".encoding'
#
sh-4.2# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
sh-4.2# ruby -e 'p "string_value".encoding'
#
```

### The behavior in the 3.3 image

```
% docker run --rm -it --entrypoint sh amazon/aws-lambda-ruby:3.3
sh-5.2# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
sh-5.2# ruby -e 'p "string_value".encoding'
#
```

Due to this issue, when using Ruby 3.3, there were cases where an 'invalid byte sequence' error occurred when handling the contents of a file with UTF-8 strings from external sources. Therefore, I am addressing this by setting LANG to the existing UTF-8 encoding C.UTF-8 during the Docker build to ensure UTF-8 support.

```
% docker run --rm -it --entrypoint sh amazon/aws-lambda-ruby:3.3
sh-5.2# locale -a
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
C
C.utf8
POSIX
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Localiza la definición de build de la imagen amazon/aws-lambda-ruby:3.3 y compara su configuración regional con la de la imagen 2.7. Reproduce el problema con los comandos de Docker y Ruby indicados y, a continuación, verifica que LANG identifica una configuración regional UTF-8 disponible y que Ruby informa de una codificación de cadenas UTF-8.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
aws, docker, ruby
Área
backend, infrastructure
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.