質問編集履歴
2
試したことを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
|
29
|
-
```
|
29
|
+
```SQL
|
30
30
|
|
31
31
|
MariaDB [testdb]> insert into test(name,skill)values('みき','HTML');
|
32
32
|
|
@@ -54,7 +54,7 @@
|
|
54
54
|
|
55
55
|
①まずはDBの文字コード設定を確認。
|
56
56
|
|
57
|
-
```
|
57
|
+
```SQL
|
58
58
|
|
59
59
|
MariaDB [testdb]> show variables like "chara%";
|
60
60
|
|
@@ -86,7 +86,7 @@
|
|
86
86
|
|
87
87
|
DBの設定
|
88
88
|
|
89
|
-
```
|
89
|
+
```SQL
|
90
90
|
|
91
91
|
MariaDB [testdb]> show create database testdb;
|
92
92
|
|
@@ -104,7 +104,7 @@
|
|
104
104
|
|
105
105
|
テーブルの設定
|
106
106
|
|
107
|
-
```
|
107
|
+
```SQL
|
108
108
|
|
109
109
|
MariaDB [testdb]> desc test;
|
110
110
|
|
@@ -140,7 +140,7 @@
|
|
140
140
|
|
141
141
|
DBの設定
|
142
142
|
|
143
|
-
```
|
143
|
+
```SQL
|
144
144
|
|
145
145
|
MariaDB [(none)]> show variables like "chara%";
|
146
146
|
|
@@ -176,7 +176,7 @@
|
|
176
176
|
|
177
177
|
|
178
178
|
|
179
|
-
```
|
179
|
+
```SQL
|
180
180
|
|
181
181
|
MariaDB [(none)]> create database test2;
|
182
182
|
|
@@ -216,7 +216,7 @@
|
|
216
216
|
|
217
217
|
DB設定
|
218
218
|
|
219
|
-
```
|
219
|
+
```SQL
|
220
220
|
|
221
221
|
MariaDB [(none)]> show variables like "chara%";
|
222
222
|
|
@@ -252,16 +252,12 @@
|
|
252
252
|
|
253
253
|
|
254
254
|
|
255
|
-
```
|
255
|
+
```SQL
|
256
256
|
|
257
257
|
MariaDB [(none)]> create database test3;
|
258
258
|
|
259
|
-
|
260
|
-
|
261
259
|
MariaDB [test3]> create table table3(id int,name varchar(20),skill varchar(20));
|
262
260
|
|
263
|
-
|
264
|
-
|
265
261
|
MariaDB [test3]> insert into table3(id,name,skill)values(1,'みき','CSS');
|
266
262
|
|
267
263
|
|
@@ -284,7 +280,7 @@
|
|
284
280
|
|
285
281
|
|
286
282
|
|
287
|
-
```
|
283
|
+
```SQL
|
288
284
|
|
289
285
|
MariaDB [(none)]> set names cp932;
|
290
286
|
|
@@ -292,12 +288,8 @@
|
|
292
288
|
|
293
289
|
MariaDB [(none)]> create database newone;
|
294
290
|
|
295
|
-
|
296
|
-
|
297
291
|
MariaDB [newone]> create table tbl3(id int,name varchar(10),skill varchar(10));
|
298
292
|
|
299
|
-
|
300
|
-
|
301
293
|
MariaDB [newone]> insert into tbl3(id,name,skill)values(1,'みき','HTML');
|
302
294
|
|
303
295
|
|
@@ -332,6 +324,16 @@
|
|
332
324
|
|
333
325
|
- 文字設定の中で[character_set_client],[character_set_connection],[character_set_results]がcp932でも直らない
|
334
326
|
|
327
|
+
- ご質問に対して
|
328
|
+
|
329
|
+
1.どんな感じで文字化けしているか?
|
330
|
+
|
331
|
+
→日本語が「 ・ノ・・」「 ・・・B・E・ォ・・」のようになります。
|
332
|
+
|
333
|
+
2.プログラムは何を使ってデータを呼び出そうとしているか?
|
334
|
+
|
335
|
+
→データの呼び出し・挿入は全てコマンドプロンプト上で行っています。
|
336
|
+
|
335
337
|
|
336
338
|
|
337
339
|
ということになっています。
|
@@ -340,8 +342,106 @@
|
|
340
342
|
|
341
343
|
|
342
344
|
|
345
|
+
###追記
|
346
|
+
|
347
|
+
ご回答をいただき、以下を試してみました。
|
348
|
+
|
349
|
+
- 文字コードを「utfmb4」に設定した
|
350
|
+
|
351
|
+
```SQL
|
352
|
+
|
353
|
+
MariaDB [(none)]> show variables like "chara%";
|
354
|
+
|
355
|
+
+--------------------------+--------------------------------+
|
356
|
+
|
357
|
+
| Variable_name | Value |
|
358
|
+
|
359
|
+
+--------------------------+--------------------------------+
|
360
|
+
|
361
|
+
| character_set_client | utf8mb4 |
|
362
|
+
|
363
|
+
| character_set_connection | utf8mb4 |
|
364
|
+
|
365
|
+
| character_set_database | utf8 |
|
366
|
+
|
367
|
+
| character_set_filesystem | binary |
|
368
|
+
|
369
|
+
| character_set_results | utf8mb4 |
|
370
|
+
|
371
|
+
| character_set_server | utf8 |
|
372
|
+
|
373
|
+
| character_set_system | utf8 |
|
374
|
+
|
375
|
+
| character_sets_dir | C:\xampp\mysql\share\charsets\ |
|
376
|
+
|
377
|
+
+--------------------------+--------------------------------+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
MariaDB [test1]> create table test2(id int,name varchar(20))default charset=utf8mb4;
|
382
|
+
|
383
|
+
|
384
|
+
|
385
|
+
MariaDB [test1]> insert into test2(id,name)values(1,'みき');
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
MariaDB [test1]> select* from test2;
|
390
|
+
|
391
|
+
+------+------+
|
392
|
+
|
393
|
+
| id | name |
|
394
|
+
|
395
|
+
+------+------+
|
396
|
+
|
397
|
+
| 1 | ?ン・? |
|
398
|
+
|
399
|
+
+------+------+
|
400
|
+
|
401
|
+
```
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
- 文字コードをsjisに設定した
|
406
|
+
|
407
|
+
参照:[https://teratail.com/questions/153238](https://teratail.com/questions/153238)
|
408
|
+
|
409
|
+
```SQL
|
410
|
+
|
411
|
+
MariaDB [test3]> SET character_set_results = sjis;
|
412
|
+
|
413
|
+
MariaDB [test3]> SET character_set_client = sjis;
|
414
|
+
|
415
|
+
|
416
|
+
|
417
|
+
MariaDB [test3]> create table test2(id int,name varchar(20))default charset=sjis;
|
418
|
+
|
419
|
+
MariaDB [test3]> insert into test2(id,name)values(1,'みき');
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
MariaDB [test3]> select* from test2;
|
424
|
+
|
425
|
+
+------+------+
|
426
|
+
|
427
|
+
| id | name |
|
428
|
+
|
429
|
+
+------+------+
|
430
|
+
|
431
|
+
| 1 | ??? |
|
432
|
+
|
433
|
+
+------+------+
|
434
|
+
|
435
|
+
```
|
436
|
+
|
437
|
+
|
438
|
+
|
343
439
|
### 参考にしたURL
|
344
440
|
|
345
441
|
[https://teratail.com/questions/135821](https://teratail.com/questions/135821)
|
346
442
|
|
347
443
|
[https://teratail.com/questions/124308](https://teratail.com/questions/124308)
|
444
|
+
|
445
|
+
[https://teratail.com/questions/153238](https://teratail.com/questions/153238)
|
446
|
+
|
447
|
+
[https://qiita.com/deco/items/bfa125ae45c16811536a](https://qiita.com/deco/items/bfa125ae45c16811536a)
|
1
誤字修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -128,7 +128,7 @@
|
|
128
128
|
|
129
129
|
|
130
130
|
|
131
|
-
②
|
131
|
+
②[https://qiita.com/YusukeHigaki/items/2cab311d2a559a543e3a](https://qiita.com/YusukeHigaki/items/2cab311d2a559a543e3a)を参考に、my.iniの[client]と[mysqld]の文字コードをutf8に書き換え。
|
132
132
|
|
133
133
|
DBの設定を確認しましたが、文字コードの設定が最初と変わっていなかったので、
|
134
134
|
|
@@ -208,7 +208,7 @@
|
|
208
208
|
|
209
209
|
これでもダメだったので、
|
210
210
|
|
211
|
-
④https://teratail.com/questions/26559を参考に、
|
211
|
+
④[https://teratail.com/questions/26559](https://teratail.com/questions/26559)を参考に、
|
212
212
|
|
213
213
|
my.iniの[mysql]default-character-setをcp932に書き換え。
|
214
214
|
|
@@ -280,7 +280,7 @@
|
|
280
280
|
|
281
281
|
```
|
282
282
|
|
283
|
-
④https://teratail.com/questions/58424を参考にset namesしてみた
|
283
|
+
④[https://teratail.com/questions/58424](https://teratail.com/questions/58424)を参考にset namesしてみた
|
284
284
|
|
285
285
|
|
286
286
|
|
@@ -342,6 +342,6 @@
|
|
342
342
|
|
343
343
|
### 参考にしたURL
|
344
344
|
|
345
|
-
https://teratail.com/questions/135821
|
345
|
+
[https://teratail.com/questions/135821](https://teratail.com/questions/135821)
|
346
|
-
|
346
|
+
|
347
|
-
https://teratail.com/questions/124308
|
347
|
+
[https://teratail.com/questions/124308](https://teratail.com/questions/124308)
|