UTF-8 string support in API manager - create APIs, Applications with different languages

Here are the steps i followed in order to work UTF8 functionality in API Manager 1.4.0.
01. Create API manager database using scripts found in API Manager distribution.
02. Change master-datasources.xml to point new API manager database.
Configuration is shown below
<url>jdbc:mysql://localhost:3306/database_name?relaxAutoCommit=true&amp;characterEncoding=UTF-8&lt;/url> 
                    <username>root</username> 
                    <password>root</password> 
                    <driverClassName>com.mysql.jdbc.Driver</driverClassName> 
                    <maxActive>50</maxActive> 
                    <maxWait>60000</maxWait> 
                    <testOnBorrow>true</testOnBorrow> 
                    <validationQuery>SELECT 1</validationQuery> 
                    <validationInterval>30000</validationInterval>

03. Run alter database and table commands as follows.
   ALTER DATABASE database_name CHARACTER SET utf8 COLLATE utf8_general_ci;
   ALTER TABLE database_name_table_names CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

04. Run following command to check changes. All field values should contain utf8_unicode_ci, utf8_general_ci or desired type.
    show variables like 'collation%';

05. add following to /etc/mysql/my.cnf and restart MySQL server.
   collation-server = utf8_unicode_ci
   init-connect='SET NAMES utf8'
   character-set-server = utf8

Also followed below instructions.
 validated that there was a character set filter in /repository/conf/tomcat/carbon/WEB-INF/web.xml
 updated /repository/conf/tomcat/catalina-server.xml and added URIEncoding="UTF-8" in both Connectors
 included -Dfile.encoding=UTF-8 in /bin/wso2server.sh java startup command

06. Start API manager and perform following actions.
    create API with Japanese string. API stored in API manager database and registry properly.
    create Application with Japanese name(application name persisted to database without issue).
    create subscription and generate keys. Invoke APIs.

Here i have attached screen-shots for store and publisher and how data stored in database. After applying those configurations i was able to perform API manager operations as expected.





No comments:

Post a Comment

Empowering the Future of API Management: Unveiling the Journey of WSO2 API Platform for Kubernetes (APK) Project and the Anticipated Alpha Release

  Introduction In the ever-evolving realm of API management, our journey embarked on the APK project eight months ago, and now, with great a...