action error中文问题

本文介绍了一种将含有中文的Java资源文件转换为ASCII码的方法。通过使用Java JDK自带的native2ascii工具,可以轻松地将包含中文的消息提示文件转换成ASCII码格式,便于程序在不同环境下正确读取中文内容。

1 楼zeq258(周二强)回复于 2005-09-16 15:58:32 得分 80

解决办法和简单:  
  比如你的消息资源文件是   a.properties     里边全是中文的消息提示。  
   
  java   的   jdk   有一个工具,native2ascii  
   
  只要切换到你的消息资源的文件目录,运行下边这个指令  
   
  native2ascii       a.properties       b.properties  
   
  b.properties是你的输出文件,这个时候,你可以用b.properties做为你的消息资源文件,其实它和    
  a.properties的内容是一样的。只不过它是以ascii码来实现的。  

function dispatch(dispatch_tbl, http_form, hook) local forms = http_form and http_form["form"] local op = http_form and http_form["operation"] or "" local is_combine = http_form and http_form["is_combine"] or "no" if is_combine == "yes" then if http_form.data and #http_form.data > 0 then local tmp_tbl = json.decode(http_form.data) http_form.data = nil if tmp_tbl then for i,v in pairs(tmp_tbl) do http_form[i] = v end end end end local success = true local own_response local errorcode_tbl = {} local data, others, errorcode local function _action_cb(cb, args) local ret, errorcode, error_tbl = cb(unpack(args)) local data if ret then data = ret else success = false if errorcode then errorcode_tbl[#errorcode_tbl + 1] = errorcode end if error_tbl then data = error_tbl end end return ret, type(data) == "table" and data or nil end local function _dispatch(form) local op_tbl = dispatch_tbl[form] local action if op_tbl then action = op_tbl[op] or op_tbl[".super"] end if action and action.cb then local args = op_tbl[".args"] and {http_form, op_tbl[".args"], action.args} or {http_form, action.args} local ret, data = _action_cb(action.cb, args) local others if action.others then _, others = _action_cb(action.others, args) end if hook and hook.post_hook then _action_cb(hook.post_hook, {ret, action}) end own_response = own_response or action.own_response return data, others, action else success = false errorcode_tbl[#errorcode_tbl + 1] = "no such callback" end end local function _merge(tbl, updates, action, form) if #updates == 0 then -- @updates is a key-value table, or empty array local prefix = action and action.merge_prefix if prefix then util.update_prefix(tbl, updates, prefix) else util.update(tbl, updates) end else -- @updates is a non-empty array util.update(tbl, {[form] = updates}) end end if type(forms) ~= "table" then -- Single form local form = forms data, others = _dispatch(form) else -- Multiple forms for _, form in ipairs(forms) do local data_ret, others_ret, action = _dispatch(form) if data_ret then data = data or {} _merge(data, data_ret, action, form) end if others_ret then others = others or {} _merge(others, others_ret, action, form) end end end if #errorcode_tbl > 0 then errorcode = table.concat(errorcode_tbl, "&") end if is_combine == "yes" then if success then data = data or {} local tmp = {} tmp.error_code = 0 if others then for i,v in pairs(others) do data[i] = v end end tmp.result = data data = {["result"] = json.encode(tmp)} -- data = {["result"] = data.result} else local tmp = {} tmp.error_code = 1 tmp.msg = errorcode data = {["result"] = json.encode(tmp)} -- data = {["result"] = json.encode(data)} end local res = { success = true, data = data } return res else return { success = success, data = data, others = others, errorcode = errorcode } end end 前端返回success = false,请帮我对以上代码加打印调试
11-21
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值