Developing Java Applications with Unicode Data
Author: Shazin Sadakath
Developing Java Applications with Unicode Data
Author: Shazin Sadakath
Recently we got to work with a Japanese client and had to develop the backend and REST API to work with Japanese Characters. Following are some of the lessons we learnt during that Software Development work.
Since we were using AWS IaaS (AWS Linux) we followed the instruction available at AWS Documentation to change the timezone. So please following your Infrastructure documentation to set up the timezone.
CREATE DATABASE DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
This is important as data will be stored eventually on the database. So please check your Database Server manual on how to create a Database with UTF8 Encoding.
Changing the configuration file for MySQL and adding following;
default-time-zone = '+09:00'
The setting is from + or - no of hours from GMT time. So please check your Database Server manual on how to set the timezone. After which Database server must be restarted.
jdbc:mysql://localhost/?useUnicode=yes&characterEncoding=UTF-8&useTimezone=true&serverTimezone=Asia/Tokyo
In MySQL we used useUnicode, characterEncoding, useTimezone, serverTimezone to create a JDBC Connection which uses Unicode encoding and Japanese Timezone. So please your JDBC Driver based on Database server to configure the connection if required.
Following Jackson2ObjectMapperBuilderCustomizer must be configured to set the timezone.
@Bean
public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() {
return jacksonObjectMapperBuilder ->
jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
}
Finally testing is required make sure everything works well together.
Годнота спасибо _________________ [URL=https://ua.onlinebestrealmoneygames.xyz/avtomati-gralni-onlayn-ukraina/]Автомати гральні онлайн украина[/URL].
Read MoreRSocket Jwt Authentication/Authorization using Spring Security 5.2.0.RC1
. Read MorePlease login or register to post a comment.
There are currently no comments.