返回顶部

收藏

Check the string encoding

更多
# -*- coding: utf-8 -*-
s = '2×2=4'     # Note multibyte multiplication character
s.encoding      # => <Encoding: UTF-8>
t = '2+2=4'     # All characters are in the ASCII subset of UTF-8
t.encoding      # => <Encoding: ASCII-8BIT>

标签:Ruby,String

收藏

0人收藏

支持

0

反对

0

发表评论