method
encode!
v1_9_3_392 -
Show latest stable
- Class:
String
encode!(*args)public
The first form transcodes the contents of str from str.encoding to encoding. The second form transcodes the contents of str from src_encoding to dst_encoding. The options Hash gives details for conversion. See String#encode for details. Returns the string even if no changes were made.
1Note
output GBK
'I am 中国人'.encode('gbk','utf-8')