LoginSignup
1
0

More than 5 years have passed since last update.

内部エンコーディングと違う文字コードでURLエンコーディングする

Last updated at Posted at 2012-09-06
$str = mb_convert_encoding($str, 'EUC-JP');
$encoded_str = rawurlencode($str);

ついでに
文字列の文字コードを判定

echo mb_detect_encoding($str);

とか

echo mb_detect_encoding($str, array('ASCII', 'UTF-8', 'EUC-JP'));

など。
第二引数のデフォルトはmb_detect_order()で、
手元ではASCIIとUTF-8しか含まれていなくて、EUC-JPが判定できなかった。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0