Contents [hide]
Output
%BC%D6 車
Code examples
JavaScript
1 2 3 4 5 6 7 | const iconv = require( 'iconv-lite' ) const fs = require( "fs" ); let utf8str = "車" let eucbuffer = iconv.encode(utf8str, 'eucjp' ) console.log( [...eucbuffer ].map(n => `%${n.toString(16).toUpperCase()}`).join( "" ) ) utf8str = iconv.decode(eucbuffer, 'eucjp' ) console.log(utf8str) |
PHP
1 2 3 4 5 6 7 | <?php $utf8str = "車" ; $eucstr = mb_convert_encoding( $utf8str , 'euc-jp' , 'utf8' ); print rawurlencode( $eucstr ). "\n" ; $utf8str = $eucstr ; $utf8str = mb_convert_encoding( $utf8str , 'utf8' , 'euc-jp' ); print $utf8str . "\n" ; |
Perl
1 2 3 4 5 6 7 8 9 | use Encode::EUCJPMS; use URI::Escape; my $utf8str = "車" ; my $eucstr = $utf8str ; Encode::from_to( $eucstr , "utf8" , "eucjp-ms" ); print uri_escape( $eucstr ). "\n" ; $utf8str = $eucstr ; Encode::from_to( $utf8str , "eucjp-ms" , "utf8" ); print ( $utf8str . "\n" ); |
Python
1 2 3 4 5 | import urllib.parse utf8str = "車" eucstr = utf8str.encode( 'euc-jp' ) print (urllib.parse.quote(eucstr)) print (eucstr.decode( 'euc-jp' )) |
Ruby
1 2 3 4 5 6 | require 'uri' utfstr = "車" eucstr = utfstr.encode( "EUC-JP" ) print( URI .escape(eucstr)+ "\n" ) utfstr = eucstr.encode( "UTF-8" , "EUC-JP" ) print(utfstr+ "\n" ) |

Author: Hajime Kurita, CEO/CTO of 1st Class, inc. Search Engineer & Web master
Certificate: AWS SOL Architect, Professional Scrum Master I, Class I IT Engineer(JP national certificate), TOEIC900+, Graduate of Tokyo university
Please follow My English twitter account for updates
IT Relatd service: VPS Ranking