- 12.10-12.23:
去除单词后面可能存在的隐藏的不可见的字符。比如:venue & zwnj; Identify the codepoint: The zero-width joiner is U+200D. The zero-width space is U+200B.
str.gsub(/[\u200B-\u200D\uFEFF]/, '[HIDDEN]'); invisible_string ; class MyModel < ApplicationRecord before_save :strip_zero_width_chars private def strip_zero_width_chars attributes.each do |attr, value| if value.is_a?(String) self[attr] = value.gsub(/[\u200B\u200C\u200D\uFEFF]/, '') end end end end