Garbled japanese title in html - SHIFT JIS - html

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>

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

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>

Related

Quotation marks inside <pre> element showing as “ or similar character

I'm just trying to post a simple html file consisting mainly of some prose I wrote inside of <pre> elements.
Interestingly, when I view the file on my computer with my browser, the quotation marks display fine. But when I upload it to my website, quotation marks are rendered as something like “ or â€. I have looked around the web for solutions but they were few and in between.
I tried to use the meta tag and included
<meta http-equiv="Content-Type" content="text/html; charset="utf-8" />
to my header but to no avail. Any ideas on how to solve this? It just wouldn't make sense to go back to the content inside the elements and code it into html as the prose is a draft and will go through many changes in the future.
The <!doctype html> tag indicates the file is HTML5 - so the browser will render it as such. lang="en" should be set to the language you are working with. Be sure to use the <meta charset="utf-8"> tag to set the character set in the <head>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Template</title>
</head>
<body>
<pre>This is my stuff</pre>
</body>
</html>
Check your code with the browser's View Source and use the Validator at https://validator.w3.org/ to check the page.
Here what I tried.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<body>
<pre>Einstein said,"Once you stop learning, you start dying"</pre>
</body>
</html>
I also tried only this
<body>
<pre>Einstein said,"Once you stop learning, you start dying"</pre>
</body>
Still working

character encoding in a html page

I have 2 html pages (index.html and game.html) where I specify the same character encoding UTF-8
in the first page (index.html) every thing works fine but in the second page all characters appear like this �
this is the code of 2 pages :
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title> أصوات</title>
</head>
<body dir="rtl" lang='ar' class="contentBack">
</body>
</html>
the result in my browser:
how can I solve this problem ?
Make sure the file is also saved with the corresponding encoding (in your case UTF8). Setting the right meta charset may not be enough.

how can i display a "é" using <h2>

I want to display a special caracter but when i used <h2></h2> this caracter does not appear on the web-site page.
<h2>Aéroport Tunis Carthage </h2>
on the web-site the text is: Arport Tunis Carthage.
<h2>Aéroport Tunis Carthage</h2> will do it.
Handy info on encoding can be found here and info on html character entities here.
There are two ways for displaying special characters in HTML:
1) Using HTML entities. For example:
Aéroport
2) Encoding the source HTML file appropriately (e.g. using UTF-8) and then indicating such encoding in the HTML head:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<h2>Aéroport Tunis Carthage </h2>
</body>
</html>
Of course, you have to use a text editor capable of writing files in the desired encoding. Otherwise you should indicate in the <head> the encoding used by the editor.
Try adding this to your meta tags:
HTML4:
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
HTML5:
<meta charset="UTF-8">
Source:
http://www.w3schools.com/tags/att_meta_http_equiv.asp
EXAMPLE:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Meta Tag -->
<meta charset="UTF-8"> <!-- HTML5 -->
<title> Your title here </title>
</head>

Turkish characters does not display correctly

i have the following code. it contain Turkish content. but i get the results including special charecter. so please give solution for that.
html code
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<META HTTP-EQUIV="content-language" CONTENT="TR" />
<title>test</title>
</head>
<body>
Tarihçe
</body>
</html>
i will get Tarih�e instaed of Tarihçe.
If you can use Turkish encoding below will be the meta tag
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />
else code Tarihçe as
Tarihçe
Change the actual character encoding of the file to UTF-8, using whatever settings need to be used in the program you use to create and edit pages. The file is now in some 8-bit encoding, so the letter ç appears in the data as a byte that is not allowed in UTF-8; hence the � symbol (it indicates character-level data error).

How to not decode special characters in links?

If you save this file and hover over the link, firefox will decode %2F%2F to // and hence the link is broken.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
linux%2F%2Funix_servers.html
Are there ways to prevent the browser from decoding the special characters in links?
If the URL is to contain the real percent sign “%”, then by the applicable encoding rules, it must be %-encoded, as “%25”. Thus the URL should be written as linux%252F%252Funix_servers.html
It only displays the text of the link as // since %2f is a slash in HTML. The link itself is fine and should link to the file you had with no issue. Use % to represent a % in html.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
linux%2F%2Funix_servers.html
</body>