Current location: Hot Scripts Forums » Programming Languages » PHP » iso-2022-jp to Shift_JIS with php


iso-2022-jp to Shift_JIS with php

Reply
  #1 (permalink)  
Old 01-23-04, 12:23 AM
i-creations i-creations is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
iso-2022-jp to Shift_JIS with php

Hi there

Need some big help!!

I have a program running that uses IMAP to read an email off the server then display it on a web page.

What I want to do is rather than displaying it on a web page, to save it as a text file on server

I managed to do that but the character set is a big problem

the programme puts the main message of the email into a variable
&body

however this is not readable as it is decoded for iso-2022-jp
therefore, when &body is saved as a text file the message is unreadable

i need the &body in the Shift_JIS format
is there any way during the saving of the text file process to convert iso-20220jp into Shift_JIS then save on the server so its readable

thanks in advance for any help
yours
tok
japan
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-23-04, 01:43 AM
blaw's Avatar
blaw blaw is offline
Junior Code Guru
 
Join Date: Dec 2003
Location: Vancouver, BC, Canada
Posts: 550
Thanks: 0
Thanked 0 Times in 0 Posts
Hi.

The best way to deal with Japanese encoding (or any multi-byte codes) in PHP is to use mbstring extension. I believe there is a function(s) that converts among those Japanese encoding scheme, including the ones you are inquiring about. I assume you read Japanese:

PHP.net Manual mbstring
http://www.php.net/manual/ja/ref.mbstring.php

I believe it's bundled with PHP by default (ver.4.2x or later), but you must enable it when you compile PHP with --enable-mbstring (and --enable-mbstr-enc-trans if your PHP is earlier than 4.30 and --enable-mbregex if you need Japanese regular expressions).

If you somehow can't do this (e.g. shared server, don't-know-how, etc), you can try jcode.phps, which does not require any modification to your PHP setting:

http://www.spencernetwork.org/

Finally there are many articles written in Japanese that deal with Japanese encoding scheme in PHP, as well as the Japanese PHP communities (such as http://www.php.gr.jp/ ) - you may want to check those out, too.

Good luck.
__________________
Blavv =|
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 03:22 AM
PHP Dudes - Hi All stuart New Members & Introductions 4 05-03-04 02:22 PM
100 Web Templates & 10 PHP Scripts for sale! HostersUK.co.uk General Advertisements 0 01-10-04 01:31 AM
Realtime PHP Code Obfuscation barrywien General Advertisements 1 11-16-03 07:50 PM
How to convert php generated pages to SE friendly HTML or PHP(SE friendly) -CLASS 101 crippled PHP 1 11-16-03 07:37 AM


All times are GMT -5. The time now is 05:28 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.