When registering an address on the table, the letter "-" becomes "?"

Asked 1 years ago, Updated 1 years ago, 125 views

It's the same as the topic.When saving your address: The letter '-' should be '?'

My MySQL database character code is SJIS.
JDBC extracts the address data from Table A and stores it in Table B.

But when you save your address: The letter '-' will be '?'

For example: "2 Chome 2-29" means "2 Chome 2-29" in the database if you save it.

The JDBC connection settings are as follows.

 connection=DriverManager.getConnection("jdbc:mysql://"+LOCALHOST+"/"+
    DEFAUL_DB_NAME+"?useUnicode=true&characterEncoding=SJIS", LOCAL_USER, LOCAL_PASSWORD)

Can someone help me?

java mysql encoding

2022-09-30 19:44

1 Answers

Please tell me how to register characters such as ②2- in MySQL. has similar problems and solutions, so I think I can use them as a reference.

When I created a MySQL verification environment in Windows and tried it, sjis causes garbled characters when registering, but by setting the collation of tables and columns to cp932, there was no garbled characters when registering or reading.
(JDBC connection string characterEncodings is ms932)

The MySQL and JDBC driver versions were verified below.

  • MySQL 5.5.34 Community Server
  • mysql-connector-java 5.1.37

However, this procedure changes the character code in the table and column.If you have already registered your data, please back it up after you dump it.

I hope it will be helpful.


2022-09-30 19:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.