use the same charset as in RT::SQL($re_keyword) to decide if we shall quote or not

the old regex could cause parse error, see #27170.
the issue was introduced by 3bef226, so 4.0 isn't affected.
Merge branch '4.2/cf-with-unusual-chars-in-search-builder' into 4.2-trunk