Javascript assertion does not work with with national characters (ñ,ó,...) on GW 11
search cancel

Javascript assertion does not work with with national characters (ñ,ó,...) on GW 11

book

Article ID: 374859

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

We have detected problems in managing national characters in the APIGW 11, that were not encountered with 10.1

When Executing a JS to get a context message, doing some operations on it and then setting it back in the context message variable of the gateway, changes national characters that may exist in some fields

(e.g. the message is the JSON for a create Application and those characters may appear in description or name of the application to be created).

Those characters are converted into "?".

Environment

Gateway 11.1

Resolution

To resolve this you can set the "-Dfile.encoding=UTF8" in the gateway system-properties file . 

/opt/SecureSpan/Gateway/node/default/etc/conf/system.properties

 The container gateway provides the environment variable "EXTRA_JAVA_ARGS", this variable defines any JVM properties to be added.

The default charset of the JVM is determined at the JVM startup and depends on the charset and locale of the underlying operating system.

https://techdocs.broadcom.com/us/en/ca-enterprise-software/layer7-api-management/api-gateway/congw11-1/reference/gateway-system-properties.html

For container based gateway's for GW 11.x  there are some additional steps to set the default file encoding for the JRE to UTF-8 see steps below as they are not installed by default on the OS image.

How to set the default locale in UBI 8 images ? (Container Gateway 11.x  is build on UBI )

Issue

  • How to set the default locale as en_US.utf8 in UBI 8 minimal image ?
  • The default locale for UBI 8 minimal image is set as C.utf8. How to change the default locale to en_US.utf8 ?
  • locale command is returning the C.utf8 in the UBI 8 image. How to change the locale to en_US.utf8?

Resolution

Install the required glib-langpack-XX while building the container. If the requirement is to set the default locale as en_US.utf8, then install the package glibc-langpack-en. Example:

FROM registry.access.redhat.com/ubi8/ubi-minimal:8.1
RUN microdnf install glibc-langpack-en; sed -i 's/^LANG=.*/LANG="en_US.utf8"/' /etc/locale.conf
set ENV LANG=en_US.utf8

Note: For UBI 8 image (not minimal), use yum/dnf command instead of microdnf command.

To find all the available langpack, execute the command yum search glibc-langpack'. With UBI 8 repos, onlyglibc-langpack-en` is shipped. So to find all the available packages, execute yum search on a registered RHEL node.
Root Cause
glibc-minimal-langpack is installed by default for C, POSIX and C.UTF-8 locales.