ã©ããããããæ¸ãããæ°å¤æååç §ãUTF-8ã«ããã¹ã¯ãªããããã£ãã®ã§ããã¦ã¿ããå®æåã¯ã©ã¹ãã®ä¸è¡ã ããªãã§ããã©ãã¼ããã¼ã $KCODE='u' # æå㯠16bit ã¨ä»®å® s1 = '人çï½µï¾ï¾'.unpack('U*').collect {|c| c >= 255 ? '&#' + c.to_s + ';' : c.chr }.join s2 = 'ï¼¼(^o^)ï¼'.unpack('U*').collect {|c| c >= 255 ? '&#x' + c.to_s(16) + ';' : c.chr }.join s = s1 + s2 puts 'å ãã¼ã¿ ("人çï½µï¾ï¾"ã¯10é²,"ï¼¼(^o^)ï¼"ã¯16é²)' puts s #=>人生オワタ\(^o^)/ puts
{{#tags}}- {{label}}
{{/tags}}