Created
July 4, 2012 06:11
-
-
Save larryzhao/3045668 to your computer and use it in GitHub Desktop.
Twitter::Autolink breaks in jruby when text contains Chinese or Japanese
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
require 'twitter-text' | |
options = { :username_include_symbol => true } | |
text = "@baozi hi you are a dog #dog" | |
text_cn = "@baozi 嗨你是一条狗诶 #狗狗" | |
text_jp = "@baozi ねえ、あなたは犬だ #犬" | |
puts "=== original ===" | |
puts text | |
puts text_cn | |
puts text_jp | |
puts "=== autolinked ===" | |
puts Twitter::Autolink.auto_link(text, options) | |
puts Twitter::Autolink.auto_link(text_cn, options) | |
puts Twitter::Autolink.auto_link(text_jp, options) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment