首页 \ 问答 \ 正确解码包含c#\ u003c或\ u00252等字符串的文本(Properly decode a text that contains strings like \u003c or \u00252 in c#)

正确解码包含c#\ u003c或\ u00252等字符串的文本(Properly decode a text that contains strings like \u003c or \u00252 in c#)

我有一个JSon响应,里面包含很多\ u003c或\ u00252或其他类似的字符串。 我需要一个合适的函数才能将这些字符串解码为正确的字符。


I have a JSon response that contains lots of \u003c or \u00252 or other similar strings inside. I need a proper function in order to decode these strings into proper characters.


原文:https://stackoverflow.com/questions/6149479
更新时间:2023-03-29 17:03

最满意答案

为了增加输入和标签字段的ID和FOR,您可以使用:

.attr(attributeName,function)

在你的CSS你需要改变:

.field-r input[type="radio"]#coming-yes+label {
   cursor: url('/assets/images/happy.png'), pointer;    
}
.field-r input[type="radio"]#coming-no+label {
   cursor: url('/assets/images/sad.png'), pointer;  
}

至:

.field-r input[type="radio"].coming-yesRadio+label {
    cursor: url('/assets/images/happy.png'), pointer;
}
.field-r input[type="radio"]..coming-noRadio+label {
    cursor: url('/assets/images/sad.png'), pointer;
}

相反,要在CSS中通过id来处理每个元素,您可以使用一个类。 这意味着将相应的类添加到您的输入元素。

片段:

$('.addguest').on('click', function(e) {
    e.preventDefault();
    //
    // get the current number of ele and increment it
    //
    var i = $('.guest').length + 1;
    $('.guest').first().clone().find("input").attr('id', function(idx, attrVal) {
        return attrVal + i;  // change the id
    }).attr('name', function(idx, attrVal) {
        return attrVal + i;  // change the name
    }).val('').removeAttr('checked').end().find('label').attr('for', function(idx, attrVal) {
        return attrVal + i; // change the for
    }).end().insertBefore(this);
});
@font-face {
    font-family: 'dk_vermilionregular';
    src: url('http://adrianandemma.com/assets/fonts/dk_vermilion-webfont.woff2') format('woff2'),
    url('http://adrianandemma.com/assets/fonts/dk_vermilion-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
* {
    font-weight:normal;
    box-sizing:border-box;
    font-family:'dk_vermilionregular', arial, sans-serif;
}
body {
    font-family:'dk_vermilionregular', arial, sans-serif;
    color:#363e3f;
    line-height: 1.2;
}
.box {
    text-align:center;
    max-width: 60%;
    margin:0 auto;
}
h1 {
    font-size:86px;
    margin:0.5em 0;
}
h1 span {
    display:block;
    font-size: 40px;
}
h2 {
    font-size:68px;
    margin:0.5em 0;
}
p {
    font-size: 40px;
    margin:0.5em 0;
}
a {
    color: #363e3f;
}

a.btn {
    display: inline-block;
    font-size:24px;
    color:#363e3f;
    text-decoration: none;
    padding:12px 20px 8px;
    border:1px solid #363e3f;
    margin: 20px 0 0;
}

/*** Images ***/
img {
    max-width:100%;
}
img.ae {
    width:260px;
}
img.ceremony {
    width:300px;
    margin:0 0 20px;
}

/*** Forms ***/
#rsvp {
    z-index: 110;
    display: table;
    table-layout: fixed;
    position: fixed;
    width:100%;
    height: 100%;
    top: 0px;
    bottom: 0px;
    left: 0px;
    right: 0px;
    background: rgba(255,255,255,1);
}

.form-container {
    display: table-cell;
    vertical-align: middle;
}

form {
    width: 600px;
    max-width: 60%;
    margin:0 auto;
}

form p {
    font-size:24px;
    margin: 0;
}

.form-row {
    overflow: auto;
    margin:0 0 10px;
}

.field-l {
    float:left;
    width: 70%;
    padding-right: 20px;
}

.field-r {
    float:right;
    width: 30%;
    text-align: right;
    cursor: default;
}

.field-l input {
    display:block;
    width: 100%;
    height: 40px;
    vertical-align: middle;
    padding: 0 10px;
    box-shadow: none;
    border:1px solid #363e3f;
}

.field-r label {
    font-size:20px;
    height: 40px;
    line-height: 40px;
    display: inline-block;
    padding: 0 10px;
    border: 1px solid #ddd;
    width: 40%;
    margin:0 0 0 5px;
    text-align: center;
}

.field-r input[type="radio"]:checked+label {
    border: 1px solid #363e3f;
}

.field-r input[type="radio"].coming-yesRadio+label {
    cursor: url('http://adrianandemma.com/assets/images/happy.png'), pointer;
}
.field-r input[type="radio"].coming-nosRadio+label {
    cursor: url('http://adrianandemma.com/assets/images/sad.png'), pointer;
}

.field-r input {
    width: 0;
    margin: 0;
    visibility: hidden;
    cursor: default;
}

form button {
    display: block;
    width:100%;
    border:1px solid #363e3f;
    background: #fff;
    margin:30px 0 0;
    font-size: 24px;
    padding: 10px 0 7px;
    cursor: pointer;
}

form button:hover {
    background: #fcfcfc;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>


<div class="form-row guest">
    <div class="field-l">
        <input type="text" name="name" id="name" required />
    </div>
    <div class="field-r">
        <input type="radio" name="coming" class="coming-yesRadio" id="coming-yes" value="Yes" required><label for="coming-yes">Yes</label>
        <input type="radio" name="coming" class="coming-yesRadio" id="coming-no" value="No"><label for="coming-no">No</label>
    </div>
</div>
<a class="addguest" href="#">Add further guest</a>


In order to increment the IDs and FORs of your input and label fields you can use:

.attr( attributeName, function )

In your css you need to change from:

.field-r input[type="radio"]#coming-yes+label {
   cursor: url('/assets/images/happy.png'), pointer;    
}
.field-r input[type="radio"]#coming-no+label {
   cursor: url('/assets/images/sad.png'), pointer;  
}

To:

.field-r input[type="radio"].coming-yesRadio+label {
    cursor: url('/assets/images/happy.png'), pointer;
}
.field-r input[type="radio"]..coming-noRadio+label {
    cursor: url('/assets/images/sad.png'), pointer;
}

Instead to address each element by id in your CSS you may use a class. That means to add the corresponding class to your input elements.

The snippet:

$('.addguest').on('click', function(e) {
    e.preventDefault();
    //
    // get the current number of ele and increment it
    //
    var i = $('.guest').length + 1;
    $('.guest').first().clone().find("input").attr('id', function(idx, attrVal) {
        return attrVal + i;  // change the id
    }).attr('name', function(idx, attrVal) {
        return attrVal + i;  // change the name
    }).val('').removeAttr('checked').end().find('label').attr('for', function(idx, attrVal) {
        return attrVal + i; // change the for
    }).end().insertBefore(this);
});
@font-face {
    font-family: 'dk_vermilionregular';
    src: url('http://adrianandemma.com/assets/fonts/dk_vermilion-webfont.woff2') format('woff2'),
    url('http://adrianandemma.com/assets/fonts/dk_vermilion-webfont.woff') format('woff');
    font-weight: normal;
    font-style: normal;
}
* {
    font-weight:normal;
    box-sizing:border-box;
    font-family:'dk_vermilionregular', arial, sans-serif;
}
body {
    font-family:'dk_vermilionregular', arial, sans-serif;
    color:#363e3f;
    line-height: 1.2;
}
.box {
    text-align:center;
    max-width: 60%;
    margin:0 auto;
}
h1 {
    font-size:86px;
    margin:0.5em 0;
}
h1 span {
    display:block;
    font-size: 40px;
}
h2 {
    font-size:68px;
    margin:0.5em 0;
}
p {
    font-size: 40px;
    margin:0.5em 0;
}
a {
    color: #363e3f;
}

a.btn {
    display: inline-block;
    font-size:24px;
    color:#363e3f;
    text-decoration: none;
    padding:12px 20px 8px;
    border:1px solid #363e3f;
    margin: 20px 0 0;
}

/*** Images ***/
img {
    max-width:100%;
}
img.ae {
    width:260px;
}
img.ceremony {
    width:300px;
    margin:0 0 20px;
}

/*** Forms ***/
#rsvp {
    z-index: 110;
    display: table;
    table-layout: fixed;
    position: fixed;
    width:100%;
    height: 100%;
    top: 0px;
    bottom: 0px;
    left: 0px;
    right: 0px;
    background: rgba(255,255,255,1);
}

.form-container {
    display: table-cell;
    vertical-align: middle;
}

form {
    width: 600px;
    max-width: 60%;
    margin:0 auto;
}

form p {
    font-size:24px;
    margin: 0;
}

.form-row {
    overflow: auto;
    margin:0 0 10px;
}

.field-l {
    float:left;
    width: 70%;
    padding-right: 20px;
}

.field-r {
    float:right;
    width: 30%;
    text-align: right;
    cursor: default;
}

.field-l input {
    display:block;
    width: 100%;
    height: 40px;
    vertical-align: middle;
    padding: 0 10px;
    box-shadow: none;
    border:1px solid #363e3f;
}

.field-r label {
    font-size:20px;
    height: 40px;
    line-height: 40px;
    display: inline-block;
    padding: 0 10px;
    border: 1px solid #ddd;
    width: 40%;
    margin:0 0 0 5px;
    text-align: center;
}

.field-r input[type="radio"]:checked+label {
    border: 1px solid #363e3f;
}

.field-r input[type="radio"].coming-yesRadio+label {
    cursor: url('http://adrianandemma.com/assets/images/happy.png'), pointer;
}
.field-r input[type="radio"].coming-nosRadio+label {
    cursor: url('http://adrianandemma.com/assets/images/sad.png'), pointer;
}

.field-r input {
    width: 0;
    margin: 0;
    visibility: hidden;
    cursor: default;
}

form button {
    display: block;
    width:100%;
    border:1px solid #363e3f;
    background: #fff;
    margin:30px 0 0;
    font-size: 24px;
    padding: 10px 0 7px;
    cursor: pointer;
}

form button:hover {
    background: #fcfcfc;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>


<div class="form-row guest">
    <div class="field-l">
        <input type="text" name="name" id="name" required />
    </div>
    <div class="field-r">
        <input type="radio" name="coming" class="coming-yesRadio" id="coming-yes" value="Yes" required><label for="coming-yes">Yes</label>
        <input type="radio" name="coming" class="coming-yesRadio" id="coming-no" value="No"><label for="coming-no">No</label>
    </div>
</div>
<a class="addguest" href="#">Add further guest</a>

相关问答

更多

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。