note 83232 added to ref.iconv

From: Date: Fri, 16 May 2008 03:40:02 +0000
Subject: note 83232 added to ref.iconv
Groups: php.notes 
Request: Send a blank email to php-notes+get-139433@lists.php.net to get a copy of this message
iconv does not convert to sjis tildes unless you do something like this <?PHP $string = 'where are the (~) (~) tildes?'; // This is what we start off with, you can put any string in here that contains problematic characters in utf8 format echo ('this is what we start with = '.$string.'<BR />'); //print string at start $conv_str = iconv('utf-8','shift-jis'.'//TRANSLIT',$string); echo ('this is not working = '.$conv_str.'<BR />'); //Just to show that this is not working. $rstring = preg_replace ('/~/','1bytetilde',$string); //replace before conversion echo ('this is modified string here = '.$rstring.'<BR />'); //This is the modified string $conv_str2 = iconv('utf-8','shift-jis'.'//TRANSLIT',$rstring); //convert modified string $rereplace=chr(126); //$rereplace is now a one byte tilde in shift_jis $rerstring = preg_replace ('/1bytetilde/',$rereplace,$conv_str2); //rereplace with tildes echo ('this is the correct result = '.$rerstring.'<BR />'); //the correct result ?> ---- Server IP: 61.195.146.164 Probable Submitter: 218.223.193.144 ---- Manual Page -- http://www.php.net/manual/en/ref.iconv.php Edit -- https://master.php.net/note/edit/83232 Del: integrated -- https://master.php.net/note/delete/83232/integrated Del: useless -- https://master.php.net/note/delete/83232/useless Del: bad code -- https://master.php.net/note/delete/83232/bad+code Del: spam -- https://master.php.net/note/delete/83232/spam Del: non-english -- https://master.php.net/note/delete/83232/non-english Del: in docs -- https://master.php.net/note/delete/83232/in+docs Del: other reasons-- https://master.php.net/note/delete/83232 Reject -- https://master.php.net/note/reject/83232 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139433) next »