dongliang1893 2014-01-31 17:12
浏览 27
已采纳

Jquery表和带重音字符的文本问题

I created a table dynamically with Jquery my variables (in a java array was json_encoded from a php array). After this, my variables are perfect with all the accented characters. So far so good. But as soon I put them in this table the results are bad.

here's the code :

<script>
    for (var j = 0; j < 13; j++) {  
        // labels     
        if (j==0) {
            var tab_B = tab_B + "<tr><th>" + label_array2[j] + "</th><th>" + 
            label_array2[j+1] + "</th><th>" + label_array2[j+2] + "</th></tr>";
        }
        // inputs
        if ((j>0) && (j<13)) {
            var tab_B = tab_B + "<tr><td><input type='text' name='" + input_array2[(j*3)] + 
            "' maxlength='33' size='33' value='" + label_array2[(j*3)] + "'/></td><td><input type='text' name='" + 
            input_array2[(j*3)+1] + "' maxlength='5' size='5' value='" + label_array2[(j*3)+1] + 
            "'/></td><td><input type='text' name='" + input_array2[(j*3)+2] + 
            "' maxlength='6' size='6' value='" + label_array2[(j*3)+2] + "'/></td></tr>";
        }
    }

$("#recipetable").html(tab_B);
</script>

then I display the table like this :

  <table  class="reference" border="1" cellpadding="0" width="100%" id="recipetable"></table>

Some texts are truncated :

example :

Before : Pain d'épices

After : Pain d

Am I missing something ?

  • 写回答

3条回答 默认 最新

  • donglan9651 2014-01-31 17:17
    关注

    Truncation comes from not protecting your quotes. It's a simple thing. Now as for the accents, you must know that json requires utf8 encoding. If this doesn't answer the problem, please make a fiddle for us.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 远程桌面文档内容复制粘贴,格式会变化
  • ¥15 关于#java#的问题:找一份能快速看完mooc视频的代码
  • ¥15 这种微信登录授权 谁可以做啊
  • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
  • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”
  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题