MyBB Community Forums

Full Version: garbled code when posting in UTF-8
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

I am using MyBB 1.2 with mysql 5.0.24a / PHP 5.1.6-pl2-gentoo on a gentoo system. I found that if I copy a long Chinese article into clipboard from a web page and then paste in posting editbox to post, I get some garbled code (i.e., garbage code) in every 50-60 chinese characters. The content in editbox looks OK but garbled codes appear in forum's posts.

I use the exactly same clipboard content and paste in IPB 1.31's editbox and get perfect copy: no garbled codes at all in the final posts. Both IPB 1.31 and MyBB 1.2 use UTF-8 as default text encoding (browsers automatically select 'Unicode (UTF-8)" in "View --> Character Encoding").

Any ideas why this happens?

Thx.
I don't know if this is the problem, but try change your encoding in your browser. View > Encoding > Big5 if it is traditional chinese.
If it's simplified chinese, you would usually use GB2312
Jeff Wrote:I don't know if this is the problem, but try change your encoding in your browser. View > Encoding > Big5 if it is traditional chinese.
If it's simplified chinese, you would usually use GB2312

Browser will convert gb2312 to UTF-8 (according to current page's charset setting).
Here's a example:

This is what I posted:

[Image: utfpost.png]


(1)
  我的家在牯岭街,我在这里工作和居住。我们这里以前出过事,我们的好兄弟茅武,在这里刺死了他的马子。
  后来,茅武的一个同级同学从牯岭街出去。杨德昌同学在美国学电脑,攻硕士。因为一个偶然的原因改行拍上了电影。1991年,杨同学把我们牯岭街的一些故事搬上了银幕。

  我看过这出名为《牯岭街少年杀人事件》的电影。影片接近四个小时,很多人说闷。我看了之后也胸闷,由于不足为外人道的原因。
  从淡江师范毕业之后,我回到我的牯岭街家乡,成为建国中学的一个青年教育工作者。杨同学的这部电影,取景其实是在淡江中学。

Here's what I got in post:

---------------------------------------
(1)
  我的家在牯岭街,我在这里工作和居住。我们这里以前出过事,我们的好兄弟茅武,在这里刺死了他的马子。
  后来,茅武的一个同级同学从牯岭街出去。杨德昌同学在美国学电脑,攻硕士。因为一个偶然的原因改行拍上了电影。1991年,杨同学把我们牯岭街的一些故事搬上了银幕。

  我看过这出名为《牯岭街少年杀人事件》的电影。影片接近四个小时,很多人说闷。我看了之后也胸闷,由于不足为外人道的原因。
  从淡江师范毕业之后,我回到我的牯岭街家乡,成为建国中学的一个青年教育工作者。杨同学的这部电影,取景其实是在淡江中学。
---------------------------------------
I'm reading the message perfectly with the exception of only a few question marks. I'm viewing it as UTF-8. GB charset doesn't work, that probably means it's encoded in UTF-8. But I'm on a Chinese computer.

You want to send a screenshot of the results you are viewing?
The funny thing is: if I click on [Edit] of the post above, in the editbox the text looks OK (no garbled code), both in "Quick Edit" and "Full Edit".
Jeff Wrote:I'm reading the message perfectly with the exception of only a few question marks. I'm viewing it as UTF-8. GB charset doesn't work, that probably means it's encoded in UTF-8. But I'm on a Chinese computer.

You want to send a screenshot of the results you are viewing?

The '??' are the garbled codes... I added a screenshot
Another screenshot, green for good, red for garbled codes:

[Image: utfpost2.png]
This is the original web page I copied the Chinese text, if it helps:

http://www.bonbonel.org/club/lofiversion...48659.html
Well, the original version you copied from was encoded in GB18030, that could be a problem.
Pages: 1 2