0

In my html code , where i use japanese signs - title ( only title ) is garbled . It's only in japanese environment (OS) . Title shows as something like : �����i�A� . Body shows japanese signs .

I tried to set attributes like 'lang' but it doesn't work.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
    "http://www.w3.org/TR/html4/strict.dtd">
<HTML>

<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=SHIFT_JIS">
  <TITLE>ヘルプ </TITLE>
</HEAD>

<BODY>
  <H1>サーバリスト</H1>
  サーバリスト画面では、
</BODY>

</HTML>
mplungjan
  • 169,008
  • 28
  • 173
  • 236
  • What's the encoding of the actual HTML file? What `Content-Type` ***HTTP header*** (not meta tag) is it being served with? – deceze Jul 19 '18 at 15:11

2 Answers2

1

Why not use UTF8 and a simpler DOCTYPE?

You have to make sure your editor is actually saving in the codepage of the page.

Your page is fine when I save it as SHIFT-JIS and you must serve it as SHIFT-JIS - then it should work. So one of those are wrong

enter image description here

mplungjan
  • 169,008
  • 28
  • 173
  • 236
  • I don't run it in editor . It's part of big application . When i run it on my english environment with japanese settings it works fine but problem is only on virtual machine with japanese windows. And about UTF-8 - i tried it and it doesnt work. Generally you suggest that html page is good , but it can be a problem in a place where it is induced , right ? –  Jul 19 '18 at 15:30
  • What do you mean by “utf8 does not work” - it does not matter if you are using and editor or a database, the data has to be saved in or converted to the code page you use in the page and the code page used in the content headers – mplungjan Jul 19 '18 at 15:42
  • By utf-8 doesnt work i mean, that as a charset i tried to insert UTF-8 instead of shift jis and then all html page was garbled including text in body. –  Jul 19 '18 at 15:56
  • Again the DATA has to match the charcode!!! You cannot have a page full of shift jis chars and magically make them UTF8 by adding a meta tag – mplungjan Jul 19 '18 at 16:33
0

If you can use UTF-8 encoding. This works fine if the file itself is also encoded in UTF-8.

<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>ヘルプ </title>
</head>
<body>
  <h1>サーバリスト</h1>
  サーバリスト画面では
</body>
</html>
Greg
  • 1,076
  • 1
  • 9
  • 17