Discourse:添加中文用户名支持

URL的encode和decode:

Ruby:

URI.escape(foo,Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))

URI.unescape(val)

JavaScript:

encodeURIComponent(foo);

 

 匹配中文:

\u4e00-\u9fa5A


URL的encode规则:

PATH:
space => %20
plus => plus/%2B

PARAM:
space => %20/plus
plus => %2B

 

 



 

posted on 2013-11-03 20:41  唐明星  阅读(319)  评论(0编辑  收藏  举报