skip to Main Content

I have an old SQL4 database and I’m trying to re-upload it to our newly created database on Phpmyadmin. The characters in the tables are latin and japanese. I tried to change those specific columns but the result is still broken characters for the columns I need to display in Japanese.

Here is a screenshot of my problem : https://imgur.com/a/P6GWrnF

As an example, the SQL code looks like this :


CREATE TABLE `bdd` (
  `id` int(11) NOT NULL,
  `ville` varchar(50) NOT NULL DEFAULT '',
  `nom_fr` varchar(80) NOT NULL DEFAULT '',
  `nom_jp` varchar(250) CHARACTER SET sjis NOT NULL DEFAULT '',
  `adr_fr` text NOT NULL,
  `adr_jp` varchar(3000) CHARACTER SET sjis NOT NULL,
  `tel` varchar(20) NOT NULL DEFAULT '0',
  `plan` text NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


INSERT INTO `bdd` (`id`, `ville`, `nom_fr`, `nom_jp`, `adr_fr`, `adr_jp`, `tel`, `plan`) VALUES
(47, 'Tokyo', 'THE KNOT TOKYO Shinjuku', '?U ?m?b?g ?????V?h', '4-31-1 Nishi Shinjuku, Shinjuku Ku, Tokyo', '?????s?V?h???V?h4-31-1', '03-3375-6511', 'the knot.JPG'),
(3546, 'Tokyo', 'HOSHINOYA Tokyo', '???????', '1-9-1 Otemachi, Chiyoda-ku, Tokyo 100-0004', '??100-0004 ?????s?????c??????????9??1', '0570-073-066', 'HOSHINOYA TOKYO.JPG'),

2

Answers


  1. Chosen as BEST ANSWER

    Problem solved. I didn't try to change encoding any longer but created a new table with all rows in utf8mb4_unicode_ci and imported the data within this new table.


  2. SET NAMES "utf8";
    CREATE TABLE `bdd` (
      `id` int(11) NOT NULL,
      `ville` varchar(50) NOT NULL DEFAULT '',
      `nom_fr` varchar(80) NOT NULL DEFAULT '',
      `nom_jp` varchar(250) CHARACTER SET sjis NOT NULL DEFAULT '',
      `adr_fr` text NOT NULL,
      `adr_jp` varchar(3000) CHARACTER SET sjis NOT NULL,
      `tel` varchar(20) NOT NULL DEFAULT '0',
      `plan` text NOT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
    
    INSERT whatever you want
    
    

    It would be better if you stored everything in utf8 as you have multiple langueages. And before insertion you neeed to set your connection parameters accordingly so server can understand what you’re sending. Btw maybe you’ll have to
    SET NAMES 'sjis';

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search