Ruby rails,如何从日语单词中删除白色-space?

Ruby on rails, how to remove white-space from japanese word?

我正在尝试从日语单词中删除 white-space。

input   "かいしゃ(会社)"
output  "かいしゃ(会社)"

这里的space被括号给消耗掉了。它们不是您的常规 ASCII 括号,它们具有 "full width" 风格。

如果你想用ASCII括号替换它们,你可以这样做:

compact_input = input.gsub("\uFF08", '(') # and a similar step for the closing parenthesis

虽然这可能会让你的字符串在日语中看起来很奇怪(我不太了解日语,所以不能说)