Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert from UTF-8 to Shift-JIS

Tags:

php

The current email is in UTF-8. It's not working on Shift-JIS.
How can I convert from UTF-8 to SHIFT-JIS. The solution needs to be a PHP solution.

This is what I have tried so far

$subject = mb_convert_encoding ($subject, "JIS", "SJIS");

$subject = base64_encode ($subject);

$subject = "=?iso-2022-jp?B?" . $subject . "?=";    
like image 965
Dunhill Dimaapi Avatar asked Aug 31 '25 04:08

Dunhill Dimaapi


1 Answers

You can convert utf-8 to shift-JIS by doing this:

$str = mb_convert_encoding($str, "SJIS", "UTF-8");
like image 166
Oliver Nybroe Avatar answered Sep 02 '25 18:09

Oliver Nybroe