|
|
@@ -5,6 +5,12 @@
|
|
|
----------------------------------
|
|
|
local Dict = require("common.Dict")
|
|
|
local Dict2 = require("common.Dict2")
|
|
|
+local Config = require("Config")
|
|
|
+local CommonDefine = require("common.CommonDefine")
|
|
|
+
|
|
|
+local function isAllowSpaceInName()
|
|
|
+ return table.find(Config.SVR_CHANEL or {}, CommonDefine.CHANNEL_TAG_VN) ~= nil
|
|
|
+end
|
|
|
|
|
|
-- 初始
|
|
|
local dict_maxx = 0
|
|
|
@@ -143,20 +149,21 @@ end
|
|
|
local fk_letter = {
|
|
|
"[","]","\\","\"","'","/"," "," "," ","@","&","`","~","$","%","^","*","(",")","-","{","}",":",";","|","<",">","?",".","="}
|
|
|
function filterName(name)
|
|
|
- local ret = filter_spec_chars(name)
|
|
|
+ local allowSpace = isAllowSpaceInName()
|
|
|
+ local ret = filter_spec_chars(name, allowSpace)
|
|
|
if ret ~= name then
|
|
|
return
|
|
|
end
|
|
|
|
|
|
for _, v in ipairs(fk_letter) do
|
|
|
- if string.find(name, v, 1, true) then
|
|
|
+ if not (allowSpace and v == " ") and string.find(name, v, 1, true) then
|
|
|
return
|
|
|
end
|
|
|
end
|
|
|
return filter(name)
|
|
|
end
|
|
|
|
|
|
-function filter_spec_chars(s)
|
|
|
+function filter_spec_chars(s, allowSpace)
|
|
|
local ss = {}
|
|
|
local k = 1
|
|
|
while true do
|
|
|
@@ -164,7 +171,7 @@ function filter_spec_chars(s)
|
|
|
local c = string.byte(s,k)
|
|
|
if not c then break end
|
|
|
if c<192 then
|
|
|
- if (c>=48 and c<=57) or (c>= 65 and c<=90) or (c>=97 and c<=122) then
|
|
|
+ if (c>=48 and c<=57) or (c>= 65 and c<=90) or (c>=97 and c<=122) or (allowSpace and c == 32) then
|
|
|
table.insert(ss, string.char(c))
|
|
|
end
|
|
|
k = k + 1
|