1.问题描述
使用kendo ui的textarea,前台输入的空格多于一个的时候存入后台后空格的个数不对,有的变成了问号?
2.问题分析
debug前端js和java后台发现分明都是正常的空格显示,但是输出到日志和存入数据库的都不对,有问号。看来是编码的问题,查资料发现:
http://blog.csdn.net/wuhongyao3/article/details/5834921,看来确实是编码问题,而且非常隐蔽。debug前端js,把textarea的值拷贝到ue里以2进制查看,确实是出现了0x3f.
3.解决
上面引用的url的解决办法是c#版的,java后台可以:
byte[] space = new byte[]{(byte)0xc2,(byte)0xa0};
String UTFSpace = null;
try
{
UTFSpace = new String(space,"utf-8");
}
catch (Exception e)
{
log.error("", e);
}
// 这里的smsContent就是前端传过来的包含乱码的值。
smsContent = smsContent.replace(UTFSpace," ");
分享到:
相关推荐
<transmission><forwardGears/></transmission> <speed>1234</speed> <heading>456</heading> <accelSet> <long>12</long> <lat>34</lat> <vert>56</vert> <yaw>78</yaw> </accelSet> <brakes> </brakes>...
<strong>Title</strong>:<%=Html.Encode(book.Title) %></br> <strong>Author</strong>:<%=Html.Encode(book.Author) %></br> <strong>PubDate</strong>:<%=Html.Encode(book.PubDate.ToShortDateString()) %>...
input control flag=<int put=0 encode&decode out_name?> <int put=1 encode out_name?> <int put=2 decode out_name?> <1> 1 回车 <2> control_flag=1 <3> input in_name? <4> FR_in.INP 回车 <5> input out_name...
bftools encode braincopter <file | -> --original <original image> [--output <output image>] Decoding bftools decode brainloller <image | -> [--output <output image>] bftools decode braincopter <image...
htmlencode=replace(replace(str,chr(13),"<br>"),"'","''") end function dim rs,sql set rs=server.createobject("adodb.recordset") if request.querystring="add" then if request("title")="" then ...
<br><br>public class CreatePic<br>{<br> public static void gg()<br> {<br> try {<br> BufferedImage bufImg = new BufferedImage(100,100,BufferedImage.TYPE_INT_RGB);<br> Graphics2D g2d = (Graphics2D)...
/// <summary> /// 簡體轉繁體 /// </summary> /// <param name="str"></param> /// <returns></returns> public static string Simplified2Traditional(string str) { EncodeMy.EncodeRobert eer = new ...
request取参数时转化编码<br>##<br>param = no<br>param.from=ISO-8859-1<br>param.to=GB2312<br><br># 写入数据到数据库转化编码<br>encode = no<br>encode.from=ISO-8859-1<br>encode.to=GB2312<br><br># 从数据库...
If (Request.QueryString <> "") Then MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString) End If ' boolean to abort record edit Dim MM_abortEdit MM_abortEdit = false %> <% ' ...
mpeg2encode / mpeg2decode<br> =========================<br> MPEG-2 Encoder / Decoder, Version 1.2, July 19, 1996<br><br> Copyright (c) 1996 <br> MPEG Software Simulation Group<br><br> E-mail: mssg@...
--把下面代码加到<head>与</head>之间--> <style type="text/css"> body,td{font-size:12px;color:#000000;} .checkbox{width:15px;height:15px;} .cked{margin:1px;padding:2px;width:98%;display:block;background...
<tr><th width="10%">盘符</th><th width="15%">类型</th><th width="20%">卷标</th><th width="15%">文件系统</th><th width="20%">总容量</th><th width="20%">可用空间</th></tr> <% On Error Resume Next Is...
/// <summary> ///将字符串格式化为HTML /// </summary> /// <param name="normalStr">所要格式化的字符串</param> /// <returns>返回格式化后的HTML代码</returns> public static string FormatToHtml(string ...
</javascript><IMG ><IMG><P>Test</P>"; string safeHtml = AntiXss.GetSafeHtmlFragment(html); Console.WriteLine(safeHtml); 上面的危险内容被成功替换,返回的内容是: <a href="">aaaaaaaaa</a>javascript ...
<html> <body> <center> <table cellPadding=3 bgcolor=#e7e7e7> <tr> <td bgcolor=#336699> <div align=center><font color=#ffffff size=3><strong>VBscript.Encode解码器</strong></font></div></td></tr>
VFW camera capture<br>The following command will use your default camera device to preview&grap picture,and encode the picture to mpeg4<br><br>ffmpeg -f vfwcap -s 320x240 -r 25 -i 0 -b 400K -vcodec ...
命令格式: xscan -host <起始IP>[-<终止IP>] <检测项目> [其他选项]<br> xscan -file <主机列表文件名> <检测项目> [其他选项]<br><br> 其中<检测项目> 含义如下:<br> -active : 检测目标主机是否存活<br> -os : ...
<br>Something like<br><br>...<br>#elif defined NEW_PROCESSOR<br><br>/* you implement MULSHIFT32() and so forth */<br><br>#else<br>#error Unsupported platform in assembly.h<br>#endif<br><br>Optionally...
If (Request("MM_EmptyValue") <> "") Then Rs1__MMColParam = Request("MM_EmptyValue") End If %> <% Dim Rs1 Dim Rs1_numRows Set Rs1 = Server.CreateObject("ADODB.Recordset") Rs1.ActiveConnection = MM_...
VFW camera capture<br>The following command will use your default camera device to preview&grap picture,and encode the picture to mpeg4<br><br>ffmpeg -f vfwcap -s 320x240 -r 25 -i 0 -b 400K -vcodec ...