Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] OT-Japanese in PHP



Mark Sargent wrote:

> Erin D. Hughes via info@example.com wrote:
>
>> Mark Sargent wrote:
>>
>>> Erin D. Hughes via info@example.com wrote:
>>>
>>>> David E wrote:
>>>>
>>>>> From: Mark Sargent <powderkeg@example.com> on Date: Wed, 25 
>>>>> May 2005 17:31:49 +0900
>>>>>
>>>>>
>>>>>> Erin D. Hughes via info@example.com wrote:
>>>>>>
>>>>>>
>>>>>>> Mark Sargent wrote:
>>>>>>>
>>>>>>>
>>>>>>>> Hi All,
>>>>>>>> output_handler = mb_output_handler
>>>>>>>> mbstring.language = Japanese
>>>>>>>> mbstring.internal_encoding = UTF-8
>>>>>>>> mbstring.http_input = auto
>>>>>>>> mbstring.http_output = SJIS
>>>>>>>> mbstring.encoding_translation = On
>>>>>>>> mbstring.detect_order = auto
>>>>>>>> mbstring.substitute_character = none
>>>>>>>> mbstring.internal_encoding = EUC-JP
>>>>>>>>
>>>>>>>> Now, I think I still haven't got the page that requires J, 
>>>>>>>> displayed right, yet. Full code is below. Can anyone see any 
>>>>>>>> mistakes..? Cheers.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>> You haven't given any details on what seems wrong with the output.
>>>>> This is kind of obvious, but have you made sure the text in the
>>>>> database is in the sme encoding as you have 
>>>>> mbstring.internal_encoding
>>>>> set to? (You have it set twice, to different values in your config
>>>>> above - I assume the last one set gets used, but safer to just 
>>>>> make up
>>>>> your mind, don't you think?)
>>>>>
>>>>> Dave
>>>>>
>>>> Dave I agree that is another valid point.
>>>>
>>>> I think he should first rule out the other problems though
>>>>
>>>> A. Make a test page with some Japanese text in HTML and test. IS 
>>>> that OK? If yes go to B
>>>>
>>>> B. Make a test page in PHP with the same text and test. IS that OK? 
>>>> If yes go to C.
>>>>
>>>> C. Make a test PHP page that pulls data from the DB. And in 3 
>>>> separate lines with each line (data in the db encoded differently 
>>>> IE UTF-8, Shift-jis and EUC) and see what comes out right.
>>>>
>>>> Also it is important to check the co-location in your DB if your 
>>>> using MYSQL 4.XXXXXXXXXX there are very specific settings that I 
>>>> have had a lot of trouble with my self in the past..... But that is 
>>>> another issue I am sure.
>>>>
>>>> E./
>>>>
>>>>
>>> Test A:
>>> Hondaは、スポーティで安心感のある走りに加え、上質な内外装、高い安全 
>>> 性能により好評を得ているアコードシリーズ(アコード/アコードワゴン) 
>>> を 改良 し、本日より全国のホンダクリオ店から発売する。
>>>
>>>  アコードでは、充実した装備の24TLにエアロパーツや17インチアルミホ 
>>> イール、スポーツサスペンションを装備した「スポーツパッケージ」を、ア 
>>> コードワゴンでは、2.0Lエンジンを搭載したベーシックなタイプ「20A」 
>>> を、 それぞれ新たに設定。お客様の幅広い要望に応えられるタイプ設定と 
>>> した。
>>>  また今回、アコード20A、20ELのFF車と、アコードワゴン20A、24EのFF車 
>>> は「平成17年排出ガス基準75%低減レベル(★★★★低排出ガス車)」認定を新 
>>> たに取得し、高い環境性能を実現するとともにグリーン税制の適用対象を拡 
>>> 大 した。
>>>
>>>
>>> Result Test A(Comes out as coded in UTF-8)
>>> Honda縺ッ縲√せ繝昴・繝・ぅ縺ァ螳牙ソ・─縺ョ縺ゅk襍ー繧翫↓蜉 縺医∽ク願ウェ 
>>> 縺ェ蜀・、冶」・・ォ倥>螳牙・諤ァ閭ス縺ォ繧医j螂ス隧輔r蠕励※縺・k繧「繧ウ 
>>> 繝シ繝峨す繝ェ繝シ繧コ・医い繧ウ繝シ繝会シ上い繧ウ繝シ繝峨Ρ繧エ繝ウ・峨r謾ケ濶ッ 
>>> 縺励∵ 悽譌・繧医j蜈ィ蝗ス縺ョ繝帙Φ繝繧ッ繝ェ繧ェ蠎励°繧臥匱螢イ縺吶k縲・縲 
>>> 繧「繧ウ繝シ繝峨〒縺ッ縲∝・螳溘@縺溯」・y縺ョ24TL縺ォ繧ィ繧「繝ュ繝代・繝・ 
>>> d17繧、繝ウ繝√い繝ォ繝溘・繧、繝シ繝ォ縲√せ繝昴・繝・し繧ケ繝壹Φ繧キ繝ァ繝ウ 
>>> 繧定」・y縺励◆縲後せ繝昴・繝・ヱ繝・こ繝シ繧ク縲阪r縲√い繧ウ繝シ繝峨Ρ繧 
>>> エ繝ウ縺ァ縺ッ縲・.0L繧ィ繝ウ繧ク繝ウ繧呈政霈峨@縺溘・繝シ繧キ繝・け縺ェ繧ソ繧、 
>>> 繝励・0A縲阪r縲√◎繧後◇繧梧眠縺溘↓險ュ螳壹ゅ♀螳「讒倥・蟷・コ・>隕∵悍 
>>> 縺ォ蠢懊∴繧峨 l繧九ち繧、繝苓ィュ螳壹→ 縺励◆縲・縲縺セ縺滉サ雁屓縲√い繧ウ 
>>> 繝シ繝・0A縲・ 0EL縺ョFF霆翫→縲√い繧ウ繝シ繝峨 Ρ繧エ繝ウ20A縲・4E縺ョFF霆 
>>> 翫・縲悟ケウ謌・7蟷 エ謗貞・繧ャ繧ケ蝓コ貅・5・・ス取ク帙Ξ 繝吶Ν・遺・笘・・ 
>>> 笘・ス取賜蜃コ繧ャ繧ケ霆奇シ峨崎ェ榊ョ壹r譁ー縺溘↓蜿門セ励@縲・ォ倥>迺ー 
>>> 蠅・ァ閭ス繧貞ョ溽樟縺吶k 縺ィ縺ィ繧ゅ↓繧ー繝ェ繝シ繝ウ遞主宛縺ョ驕ゥ逕ィ蟇セ雎。 
>>> 繧呈僑螟ァ縺励◆縲・
>>>
>>> Now, I realized, after an email from Dave E that I had 
>>> internal.encoding as UTF-8 although the database encoding is SJIS. I 
>>> just wasn't fully understanding what all the settings were doing. 
>>> I've now changed the internal to SJIS, double checked that the page 
>>> is set for SJIS also, but, the page only displays if I either change 
>>> it in the browser to UTF-8 or set the page to that(Test A page, that 
>>> is). I've added below my settings. The original page, that displays 
>>> the database content, which is set to Shift_JIS also still doesn't 
>>> display, at all. Thoughts..? Cheers.
>>>
>>> EDIT: I went and copied the data from the database into the Test A 
>>> page and it also would only display correctly if I set it to UTF-8 
>>> in the browser. So, this narrows it down to, that the code is being 
>>> coded to UTF-8. I don't understand this, as I've set all settings to 
>>> SJIS. Obviously I'm missing something very fundamental, which I'm 
>>> sure will pointed out to me, real quick. Cheers, again.
>>>
>>> Mark Sargent.
>>>
>>>
>>> mbstring.detect_order auto
>>>
>>> mbstring.encoding_translation On
>>>
>>> mbstring.func_overload 0
>>>
>>> mbstring.http_input Auto
>>>
>>> mbstring.http_output SJIS
>>>
>>> mbstring.internal_encoding SJIS
>>>
>>> mbstring.language Japanese
>>>
>>> mbstring.substitute_character no value
>>>
>>
>> OK I got you Mark so again can I ask if you commented out the line 
>> that says AddDefaultCharset UTF-8
>>
>> Change it too
>> #AddDefaultCharset UTF-8
>>
>> That will ALWAYS make all your pages display as UTF-8 as you just 
>> stated is happening.
>>
> Hi All,
>
> Erin, I would, if it existed. I even tried adding AddDefaultCharset  
> Shift_jis..perhaps it is wrong.? Cheers.
>
> Mark Sargent.
>
>
> #
> AddDefaultCharset Shift_JIS
> AddCharset ISO-8859-1  .iso8859-1  .latin1
> AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen
> AddCharset ISO-8859-3  .iso8859-3  .latin3
> AddCharset ISO-8859-4  .iso8859-4  .latin4
> AddCharset ISO-8859-5  .iso8859-5  .latin5 .cyr .iso-ru
> AddCharset ISO-8859-6  .iso8859-6  .latin6 .arb
> AddCharset ISO-8859-7  .iso8859-7  .latin7 .grk
> AddCharset ISO-8859-8  .iso8859-8  .latin8 .heb
> AddCharset ISO-8859-9  .iso8859-9  .latin9 .trk
> AddCharset ISO-2022-JP .iso2022-jp .jis
> AddCharset ISO-2022-KR .iso2022-kr .kis
> AddCharset ISO-2022-CN .iso2022-cn .cis
> AddCharset Big5        .Big5       .big5
> # For russian, more than one charset is used (depends on client, mostly):
> AddCharset WINDOWS-1251 .cp-1251   .win-1251
> AddCharset CP866       .cp866
> AddCharset KOI8-r      .koi8-r .koi8-ru
> AddCharset KOI8-ru     .koi8-uk .ua
> AddCharset ISO-10646-UCS-2 .ucs2
> AddCharset ISO-10646-UCS-4 .ucs4
> AddCharset UTF-8       .utf8
>
Hi All,

now, just to add to the weirdness with this. The below page is set to 
UTF-8 as my home PC also wants to encode in it auto, but, the 
browser(firefox) shows as selecting Shift_JIS with Auto Detect Japanese 
selected. Can anyone shed some light on this..? Cheers.

Mark Sargent.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>何でもいい</title>
</head>
<body lang="ja">
<hr size="5">
<H1><center>Japanese Test Page</center></H1>
<hr size=\"5\">
<?php
$db = mysql_connect("localhost", "??????", "???");
mysql_select_db("Easyboarder",$db);
$result = mysql_query("Select product_name FROM Products");
while($myarray = mysql_fetch_array($result)){
echo "<p><center><font size=\"4\" 
color=\"black\">".$myarray['product_name']."</font></center></p>";
}
?>
</body>
</html>


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links