All Apple devices, such as a iPhones and iPad, display garbage for Chinese characters.

I have a website written by myself and use HTML and CSS. The website uses both English and Chinese characters. This site's displays are correct with all non-Apple devices, but the displays show garbage with all Apple devices, such as a iPhones and iPad.


<meta charset="gb18030"> was used to display the simplified Chinese characters. However,

<meta charset="utf-8"> does not do the job.


Can someone give me some hint to solve this problem.

iPhone 5s, iOS 12

Posted on Sep 19, 2022 9:25 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 19, 2022 12:41 PM

If you set gb18030 charset in the HTML header, then also save your document with GB 18030 text encoding.

If you set UTF-8 charset in the HTML header, then also save your document in UTF-8 text encoding.

How to set the text encoding for your document before saving or when saving, that depends on your editing app.

It doesn’t matter much which one you choose, but be consistent about it.

Several Chinese newspaper websites that I checked use UTF-8, so that seems like a good example to follow.

The HTML5 specification encourages UTF-8, so that seems like a good example to follow.


Both text encodings tested on iPhone/iOS16/Safari, rendering fine.


Server side processing (e.g. HTTP header charset, or e.g. Netlify deployment) can be a cause of issues.

15 replies
Question marked as Top-ranking reply

Sep 19, 2022 12:41 PM in response to sliu1689

If you set gb18030 charset in the HTML header, then also save your document with GB 18030 text encoding.

If you set UTF-8 charset in the HTML header, then also save your document in UTF-8 text encoding.

How to set the text encoding for your document before saving or when saving, that depends on your editing app.

It doesn’t matter much which one you choose, but be consistent about it.

Several Chinese newspaper websites that I checked use UTF-8, so that seems like a good example to follow.

The HTML5 specification encourages UTF-8, so that seems like a good example to follow.


Both text encodings tested on iPhone/iOS16/Safari, rendering fine.


Server side processing (e.g. HTTP header charset, or e.g. Netlify deployment) can be a cause of issues.

Sep 21, 2022 11:05 AM in response to sliu1689

Thank you very much for your reply. Following your suggestions, I recode the file with <meta charset="gb18030"> and I saved the file also with encoding "gb18030". I did this using MS word with save as Plain Text with Encoding GB18030. The Word saved result was in file.txt format, then, I have to changed it as file.htm.


However, the final result is the same as before. The display is normal for all non-Apple devices, but all Apple devices shows garbage for Chinese characters.


Then, I tried to recode the file with <meta charset="utf-8"> and saved the file also with encoding utf-8. Unfortunately, the result is the same.


Any ideas?


Sam

Sep 22, 2022 6:31 AM in response to sliu1689

Thank very much for your reply.


My site is hosted at FatCow. I used a text editor for my site and all simplified Chinese characters are written by Google Pinyin (or Microsoft Pinyin) by myself, not copyed and pasted.


The url of my website is


shihong.us or, shihong.ea28.com.


Actually, the shihong.us is pointed to shihong.ea28.com. One important fact is that shihong.us (and all .us sites) cannot be reached in mainland China.


Another fact is that If using the menu on the left column, then the display is OK. But, the left menu is not a direct content. It is introduced using a <iframe>:


<div id="menu">

<iframe src="menu.htm" name="menu" scrolling="no"></iframe> <!-- original width="168" -->

</div>


I was trying to also use a <iframe> for the main menu. However, since the main menu is too long and other tricks were used, I do not have a good result so far.


I though if I show the site not directly, then the problem might be resolved. So, I wrote a short a re-direct page with <meta charset="utf-8"> as below, and saved the code in utf-8 encoding using MS Word.


<!DOCTYPE html>

<html>

<head>

<title>石泓之园 Shihong's Garden</title>

<meta charset="utf-8">

<meta http-equiv="refresh" content="0; url=https://shihong.ea28.com/" />

<link rel="stylesheet" type="text/css" href="../../css/style-mj.css">

</head>


<body>

<p>

This is a page to re-directed to site "https://shihong.ea28.com" or "https://shihong.us"

</p>

</body>

</html>


However, this trick failed to resolve the problem.


As for the original html code, since it is too long (16 pages), I not listed in here, if interested you may use “View Page Source" to take a look at it.


By the way, on my iPhones (7 Plus and XR), even I use Chrome, only garbage for Chinese characters are displayed.


Thank you again.


Sam





Sep 21, 2022 12:43 PM in response to sliu1689

My original website is:


"shihong.us" (this will redirect to the following site.)

or

shihong.ea28.com


If you browse this site using all non-Apple devices, the display is perfect. However, if use all Apple devices, as us cell phones, iPods, the display shows only garbage for all Chinese characters.


The utf-8 (or GB18030) html is as follows:


"<!DOCTYPE html>

<html>

<head>

<title>石泓之园 Shihong's Garden</title>

<meta charset="gb18030">

<meta http-equiv="refresh" content="0; url=https://shihong.ea28.com/" />

<link rel="stylesheet" type="text/css" href="../../css/style-mj.css">

</head>


<body>

<p>

This is a page to redirect to site "https://shihong.ea28.com" or "https://shihong.us"

</p>

</body>

</html> "


As for my original site of "shihong.us" or "shihong.ea28.com", the file is very long. Let me only list the very beginning of the file as below:


"<!DOCTYPE html>

<html>

<head>

<title>Shi Hong</title>

<meta name="keywords" content="石泓,石泓之园,人,人性,人生,人生观,生命,生活,生命的意义,探讨人生,人性研究,人性学习,文学,科学,文艺,诗,音乐,美术,社会,社会主义,共产主义, "/>

<meta name="keywords" content=" "/>

<meta name="description" content=" "/>

<meta https-equiv="Content-Type" content="text/html; charset=GB18030"/>

<meta name="viewport" content="width=device-width, initial-scale=1">

<script type="text/javascript" src="js/functions.js"></script>

<link rel="stylesheet" type="text/css" href="css/style2.css">

<!-- <style>

p {

border: 0px solid red;

}

video {

margin-left: auto;

margin-right: auto;

display: block;

text-align: center; }

</style> -->

</head>


<body>

<div id = "container"> <!-- dv container -->


<!-- <img src="images/hdpic/rainbow.jpg" width="888" height="320" style="margin-left: -8px; margin-bottom: -6px;"> -->


<video width="888px" autoplay loop muted playsinline style="margin-left: -8px; margin-bottom: -6px;"> <!-- "muted" must be added. otherwise, "autoplay" won't work -->

<source src="slide3.mp4" type="video/mp4"> <!-- slide3.mp4 must be the large file with 67,620 KB made on 5/5/2022, 7:29 PM in order for the slide to be shown on the home page. --> <!-- "playsinline" must be added to play on an iphone. -->

</video> <!-- "playsinline" must be added for playing the slideshow on iphone, ipad, or Safari -->



<div id="menu"> <!-- dv menu 1289 -->

<iframe src="menu.htm" name="menu" scrolling="no"></iframe> <!-- original width="168" -->

</div> <!-- **-dv2 Use iframe to make the left in the menu layout, the file is menu.htm -->


<div id="content"> <!-- dv content -->


<p class="center" style="color: red; font-family: simsun; font-size: 9mm; font-weight: bold; ">石泓之园</p>

<p class="center" style="color: red; font-family: times; font-size: 7mm;">(Shi Hong's Garden)</p>

<span class="center" style="color: blue; font-family: simsun; font-size: 4mm;"> 使用电脑浏览比较方便,手机浏览效果较差。<br> 推荐使用的浏览器:Chrome. </span>

<a href = "https://shihong_2.ea28.com/" target="_top" style="float:right; margin-right:86px;

border: 2px orange solid; padding-right:12px;" >水平目录</a>

<br><br>

<p style="padding-left: 250px; color: navy; font-family: simsun; ">我看见过、听见过、生活过,<br>

历经逆境的磨难和顺境的欣喜。 <br>

曾经满怀对生活的美好幻想, <br>

也曾在艺术和科学的辉煌殿堂 <br>

体味过人世间至上的瑰美, <br>

和俯视宇宙中万物的真理。<br>

由此感受到生命中的极乐, <br>

知足、知命,无怨、无悔。<br>

学习、思考、探索。<br>

生命不息,探索不止。

</p>


<img src="images/d-line.gif" width="660" height = "18">


<video width="600" controls>

<source src="https://ea28.com/music/auld-lang-syne.mp4" type="video/mp4">

</video> -->

<h2>园地荟萃</h2>

<!-- <center><span style="font-size:12pt; "> (点击下列目录以显示隐藏的内容或子目录,再点击即可取消)</span></center> -->

<span class="center" style="font-size:12pt;font-family: simsun;"> 点击下列目录以显示隐藏的内容或子目录,再点击一次即可取消。 <br>更详细的目录请见左侧的目录栏。 </span>


<span class="mouse_over" style="padding-left: 66px; margin-bottom: -32px;">

<img src="images/info.gif" width="16px" style = "padding-left: 26px;" >

<p class="mouse_overtext">但是,此项功能使用了Javascript,如果你的电脑系统把 JavaScript 设置为关闭状态,则此项功能失效。 这时需要对系统重新设置,否则就只能使用左侧的目录栏了。</p>

</span>


.........."




Sep 22, 2022 5:40 AM in response to Tom Gewecke

Yes. You are correct. If use the menu on the left column, then the display is OK. But, the left menu is not a direct content. It is introduced using a <iframe>:


<div id="menu">

<iframe src="menu.htm" name="menu" scrolling="no"></iframe> <!-- original width="168" -->

</div>


I was trying to also use a <iframe> for the main menu. However, since the main menu is too long and other tricks were used, I do not have a good result so far.


By the way, on my iPhones (7 Plus and XR), even I use Chrome, only garbage for Chinese characters are displayed.


Thank you.


Sam

Sep 22, 2022 6:12 AM in response to sliu1689

sliu1689 wrote:


I was trying to also use a <iframe> for the main menu. However, since the main menu is too long and other tricks were used, I do not have a good result so far.

For some reason Safari does not pick up the charset=GB18030 code for whatever is being done with that page and instead uses its default, which is not suitable for Chinese.


By the way, on my iPhones (7 Plus and XR), even I use Chrome, only garbage for Chinese characters are displayed.

Yes, in iOS I think all browsers use Apple's display engine, while in MacOS Firefox and Chrome have their own different ones.

Sep 24, 2022 5:26 PM in response to Tom Gewecke

Tom Gewecke wrote:

Wow I think you have solved it. Works on my local copy of the source.

Interesting Mac firefox and chrome don't care, only Safari.


There are lots of things that some browsers will tolerate, and others won’t.


Which is why HTML verifiers and sanitizers can be valuable.


The W3C verifier shows the meta tag error mentioned above, and a number of other errors:

https://validator.w3.org/nu/?doc=https%3A%2F%2Fshihong.us%2F


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

All Apple devices, such as a iPhones and iPad, display garbage for Chinese characters.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.