$ gem install htmlentities
$ echo -n '测试文本' | ruby -r htmlentities -e "puts HTMLEntities.new.encode(STDIN.read, :decimal)"
测试文本
          Created
          August 31, 2017 06:44 
        
      - 
      
- 
        Save caiguanhao/2a836bed3675e2ec4e5a3e1c159fbbc2 to your computer and use it in GitHub Desktop. 
    在GBK编码HTML网页显示正常(UTF-8编码的)中文
  
        
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment