I've convinced my boss to do the typesetting stuff using PHP(PHP Version 5.2.8). And this is what I got so far(set Character encoding to Unicode(UTF-8) if you see misrendered Japanese characters):
demo page at my personal website
Kopyalamak ve textarea içine latin örnek paragraf yapıştırın ve butonuna tıklarsanız Temelde, her şey iyi çalışıyor, ben tire kullanmak için bir şey yapmadım aslında olsa (bir kontrol için Not Defteri'ne sonucu yapıştırarak doğrulayabilir ) yeni çizgilerle ayrılmış sözcükleri belirtmek için.
Bu non-latin/Asian karakterleri ile gelir Ancak, hiçbir şey yazdırılır var. Ben sadece hiç bir şey göremiyorum, üretilen herhangi bir hata mesajı almadım ...
Aşağıdaki benim kod:
<?php
$words = typesetWords($_POST['words']);
echo json_encode(array('feedback' => $words));
function typesetWords($words, $lineLength = 70)
{
try
{
$result = '';
$paragraphs = explode("\n\n", $words);
foreach($paragraphs as $paragraph)
{
$paragraph = str_replace("\n", "", $paragraph);
$length = strlen($paragraph);
$numberOfLines = intval($length / $lineLength);
$tmp = '';
if($numberOfLines > 0)
{
for($i = 0; $i < $numberOfLines; $i++)
$tmp .= substr($paragraph, $i * $lineLength, $lineLength)."\n";
$tmp .= substr($paragraph, -1 * ($length % $lineLength))."\n\n";
$result .= $tmp;
}
else $result .= $paragraph."\n\n";
}
}
catch(Exception $e)
{
return $e->getMessage();
}
return $result;
}
>
I tried to return what was sent by the form directly back, and I did see the Japanese sample paragraph without problems. So I reckon one of the PHP library functions must have caused the error, but I couldn't tell which one and how to fix it...
Şimdiden çok teşekkürler!