到饭店吃饭,吃的菜有回甜味香精 调料辛,是放了什么チ7ᅣ1

手机流量为何总是一笔糊涂账 长江日报报业集团_长江网_长江日报_武汉晚报_武汉晨报_电子报_数字报
&&&&&&&&&&
论坛用户:
| 标题导航
第5版:深度·时评
深度·关注
深度·时评
手机流量为何总是一笔糊涂账
&&&&鲁珊&&&&据央广网报道,自10月1日起三大电信运营商推出“流量不清零”政策以后,消费者纷纷在社交媒体吐槽:“流量消耗太快,以前月底还有流量,现在到月中流量已经用完”,“9天用完了平时30天的量”,“360手机卫士测出来的和运营商官网给出来的数据出入很大”……&&&&顺着这个吐槽,原本以为可以剩余到下月的流量,神奇地在月中就用完了,你以为上月有余粮,其实会透支下月的流量,你以为运营商给你福利,其实它让你在流量上花掉更多。&&&&——这个推理有什么问题?当然有问题,有证据吗?10月流量跑得快?一个建立在“我感觉我发现”基础上的推论,就像一个沙堆,一吹即散。&&&&这种沙堆式推论感性得可笑,甚至有“腹黑”之嫌。但是,如果是很多很多人的“感觉”呢?一家门户网站推出的调查中,4000余人参与调查,其中有87%的人认为10月份流量消耗比过去快很多,很多人还能举出极其反常的流量消耗证据。&&&&在央广网的报道当中,一位Z先生为此致电客服投拆,结果客服爽快地送了他500M流量。这下Z先生更狐疑了:如果流量没问题,干嘛送我500M?&&&&这真像是现代版“智子疑邻”,基本上就是心理较劲。&&&&证据呢?遗憾的是,消费者拿不到证据。&&&&电信运营客服不会提供流量查询,因为这是用户隐私。用户查不到自己的“流量隐私”,他只能查到本月还剩下多少。至于那些装了第三方软件监控流量的,那只是参考,怎么能做证据。&&&&至于流量跑快了还是跑慢了,只有运营商自己掌握,你想拿运营商自己掌握的数据去投诉它吗?&&&&有时候,我们真希望有某个较真的消费者,能有特殊途径,举证运营商偷了我们的流量,然后大佬们被迫修改规则,大家都能普惠——这真是个阴暗而幼稚的想法。&&&&不然有什么办法呢?网络通信本身是个高技术含量的活儿,说是消费者监督,哪个消费者监督得了?电信运营的供求双方,体量差距如此之大,又怎么可能形成制衡?至于监管,政府怎么可能监管到手机流量按什么标准计算?&&&&所以,惟一的出路是激活市场,打破三大巨头联手垄断电信的局面,将公益和市场分开,让竞争挤干消费过程中的各种不合理成份,不管是手机流量,还是网络速度,既还消费者知情权,又让竞争替消费者维权。国务院不久前公布国企第二次改革方案,垄断国企也在改革之列。但愿电信市场能在这一次的改革中稳步尝试,最终能惠及“手机流量”这样的神经末梢。
<INPUT type=checkbox value=0 name=titlecheckbox sourceid="SourcePh" style="display:none">
长江互动传媒网 版权所有 未经授权禁止复制和建立镜像 鄂ICP证:020001
信息网络传播视听节目许可证:1704064  增值电信业务经营许可证:鄂 B2-Convert special characters to HTML in Javascript - Stack Overflow
to customize your list.
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.
J it only takes a minute:
Join the Stack Overflow community to:
Ask programming questions
Answer and help your peers
Get recognized for your expertise
Does any one know how to convert special characters to HTML in Javascript?
'&' (ampersand) becomes '&amp' &br&
'"' (double quote) becomes '&quot' when ENT_NOQUOTES is not set.&br&
''' (single quote) becomes '&#039' only when ENT_QUOTES is set.&br&
'&' (less than) becomes '&lt'&br&
'&' (greater than) becomes '&gt'
10.3k52107141
You need a function that does something like
return mystring.replace(/&/g, "&").replace(/&/g, "&").replace(/&/g, "&").replace(/"/g, "&");
But taking into account your desire for different handling of single/double quotes.
2,02421218
The best way in my opinion is to use the browser's inbuilt HTML escape functionality to handle many of the cases. To do this simply create a element in the DOM tree and set the innerText of the element to your string. Then retrieve the innerHTML of the element. The browser will return an HTML encoded string.
function HtmlEncode(s)
var el = document.createElement("div");
el.innerText = el.textContent =
s = el.innerHTML;
alert(HtmlEncode('&;\'&&"'));
This method of escaping HTML is also used by the
though differently from the simplistic sample I have given.
Note: You will still need to escape quotes (double and single) yourself. You can use any of the methods outlined by others here.
102k30261325
20.3k64364
this generic function encodes every non alphabetic character to its htmlcode (numeric):
function HTMLEncode(str){
var i = str.length,
aRet = [];
while (i--) {
var iC = str[i].charCodeAt();
if (iC & 65 || iC & 127 || (iC&90 && iC&97)) {
aRet[i] = '&#'+iC+';';
aRet[i] = str[i];
return aRet.join('');
55.3k1569103
From Mozilla ...
Note that charCodeAt will always return a value that is less than 65,536. This is because the higher code points are represented by a pair of (lower valued) "surrogate" pseudo-characters which are used to comprise the real character. Because of this, in order to examine or reproduce the full character for individual characters of value 65,536 and above, for such characters, it is necessary to retrieve not only charCodeAt(i), but also charCodeAt(i+1) (as if examining/reproducing a string with two >letters).
The Best Solution
* (c) 2012 Steven Levithan &/&
* MIT license
if (!String.prototype.codePointAt) {
String.prototype.codePointAt = function (pos) {
pos = isNaN(pos) ? 0 :
var str = String(this),
code = str.charCodeAt(pos),
next = str.charCodeAt(pos + 1);
// If a surrogate pair
if (0xD800 &= code && code &= 0xDBFF && 0xDC00 &= next && next &= 0xDFFF) {
return ((code - 0xD800) * 0x400) + (next - 0xDC00) + 0x10000;
* Encodes special html characters
* @param string
* @return {*}
function html_encode(string) {
var ret_val = '';
for (var i = 0; i & string. i++) {
if (string.codePointAt(i) & 127) {
ret_val += '&#' + string.codePointAt(i) + ';';
ret_val += string.charAt(i);
return ret_
Usage example:
html_encode("?");
Create a function that uses string replace
function convert(str)
str = str.replace(/&/g, "&");
str = str.replace(/&/g, "&");
str = str.replace(/&/g, "&");
str = str.replace(/"/g, "&");
str = str.replace(/'/g, "&#039;");
2,12863057
function ConvChar( str ) {
c = {'&':'&', '&':'&', '&':'&', '"':'&', "'":'&#039;',
'#':'&#035;' };
return str.replace( /[&&>'"#]/g, function(s) { return c[s]; } );
alert( ConvChar('&-"-&-"->-&-\'-#-\'->') );
&-&-&-&-&-&-&#039;-&#035;-&#039;-&
In testarea tag:
&-"-&-"->-&-'-#-'->
If you'll just change a little chars in long code...
In a PRE tag -and in most other HTML tags- plain text for a batch file that uses the output redirection characters (& and >) will break the HTML, but here is my tip: anything goes in a TEXTAREA element -it will not break the HTML, mainly because we are inside a control instanced and handled by the OS, and therefore its content are not being parsed by the HTML engine.
As an example, say I want to highlight the syntax of my batch file using javascript. I simply paste the code in a textarea without worrying about the HTML reserved characters, and have the script process the innerHTML property of the textarea, which evaluates to the text with the HTML reserved characters replaced by their corresponding ISO-8859-1 entities.
Browsers will escape special characters automatically when you retrieve the innerHTML (and outerHTML) property of an element. Using a textarea (and who knows, maybe an input of type text) just saves you from doing the conversion (manually or through code).
I use this trick to test my syntax highlighter, and when I'm done authoring and testing, I simply hide the textarea from view.
function char_convert() {
var chars = ["(C)","?","(R)","?","?","?","?","$","?","%","?","ss","?","à","?","á","?","¤","?","?","?","?","?","?","?","?","§","?","?","¨","ae","?","(C)","?","AE","?","è","?","<>","ù","?","@"," 1/4 ","ú","?"," 1/2 ","?","?","EUR"," 3/4 ","ü","ss","?","?","à",",","?","?","á","?","?","?","?",",,","?","ae","…","?","?","+","?","è","?","?","é","^","AE","ê","‰","?","?","?","?","ì","","?","?","oe","?"];
var codes = ["&","&#219;","&","&#158;","&#220;","&#159;","&#221;","&#36;","&#222;","&#37;","&#161;","&#223;","&#162;","&#224;","&#163;","&#225;","&A","&#164;","&#226;","&A","&#165;","&#227;","&A","&#166;","&#228;","&A","&#167;","&#229;","&A","&#168;","&#230;","&A","&#169;","&#231;","&AE","&#170;","&#232;","&C","&#171;","&#233;","&E","&#172;","&#234;","&E","&#173;","&#235;","&E","&#174;","&#236;","&E","&#175;","&#237;","&I","&#176;","&#238;","&I","&#177;","&#239;","&I","&#178;","&#240;","&I","&#179;","&#241;","&ETH;","&#180;","&#242;","&N","&#181;","&#243;","&O","&#182;","&#244;","&O","&#183;","&#245;","&O","&#184;","&#246;","&U","&#185;","&#247;","&U","&#186;","&#248;","&U","&#187;","&#249;","&U","&#64;","&#188;","&#250;","&Y","&#189;","&#251;","&THORN;","&#128;","&#190;","&#252","&","&#191;","&#253;","&","&#130;","&#192;","&#254;","&","&#131;","&#193;","&#255;","&","&#132;","&#194;","&","&#133;","&#195;","&","&#134;","&#196;","&","&#135;","&#197;","&","&#136;","&#198;","&","&#137;","&#199;","&","&#138;","&#200;","&","&#139;","&#201;","&","&#140;","&#202;","&","&#203;","&","&#142;","&#204;","&","&#205;","&","&#206;","&","&#145;","&#207;","&","&#146;","&#208;","&","&#147;","&#209;","&","&#148;","&#210;","&","&#149;","&#211;","&","&#150;","&#212;","&","&#151;","&#213;","&","&#152;","&#214;","&","&#153;","&#215;","&","&#154;","&#216;","&","&#155;","&#217;","&","&#156;","&#218;"];
for(x=0; x&chars. x++){
for (i=0; i&arguments. i++){
arguments[i].value = arguments[i].value.replace(chars[x], codes[x]);
char_convert(this);
1,21111338
var swapCodes
= new Array(, , , , , 6, 61607);
var swapStrings = new Array("--", "--", "'",
"...", "&", "&", "&", "&", "&");
var TextCheck = {
doCWBind:function(div){
$(div).bind({
bind:function(){
TextCheck.cleanWord(div);
focus:function(){
TextCheck.cleanWord(div);
paste:function(){
TextCheck.cleanWord(div);
cleanWord:function(div){
var output = $(div).val();
for (i = 0; i & swapCodes. i++) {
var swapper = new RegExp("\\u" + swapCodes[i].toString(16), "g");
output = output.replace(swapper, swapStrings[i]);
$(div).val(output);
Another one that we use now that works. One above I have it calling a script instead and returns the converted code. Only good on small textareas (meaning not a full on article/blog ect...)
For Above. Works on most chars.
var swapCodes
= new Array(, , , , , ,161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 338, 339, 352, 353, 376, 402);
var swapStrings = new Array("--", "--", "'",
"...", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&sup2;", "&sup3;", "&", "&", "&", "&", "&", "&sup1;", "&", "&", "&frac14;", "&frac12;", "&frac34;", "&", "&A", "&A", "&A", "&A", "&A", "&A", "&AE", "&C", "&E", "&E", "&E", "&E", "&I", "&I", "&I", "&I", "&ETH;", "&N", "&O", "&O", "&O", "&O", "&O", "&", "&O", "&U", "&U", "&U", "&U", "&Y", "&THORN;", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&", "&#338;", "&#339;", "&#352;", "&#353;", "&#376;", "&#402;");
I create a javascript file that has a lot of functionality including the above.
All files needed are included. I added jQuery 1.4.4. Simply because I saw issues in other versions, yet to try them out.
Requires: jQuery & jQuery Impromptu from: /Impromptu/index.php
1. Word Count
2. Character Conversion
3. Checks to ensure this is not passed: "notsomeverylongstringmissingspaces"
4. Checks to make sure ALL IS NOT ALL UPPERCASE.
5. Strip HTML
// Word Counter
$.getScript('js/characters.js',function(){
$('#adtxt').bind("keyup click blur focus change paste",
function(event){
TextCheck.wordCount(30, "#adtxt", "#adtxt_count", event);
$('#adtxt').blur(
function(event){
TextCheck.check_length('#adtxt'); // unsures properly spaces-not one long word
TextCheck.doCWBind('#adtxt');// char conversion
TextCheck.wordCount(30, "#adtxt", "#adtxt_count", false);
&textarea name="adtxt" id="adtxt" rows="10" cols="70" class="wordCount"&&/textarea&
&div id="adtxt_count" class="clear"&&/div&
// Just Character Conversions:
TextCheck.doCWBind('#myfield');
// Run through form fields in a form for case checking.
// Alerts user when field is blur'd.
var labels = new Array("Brief Description","Website URL","Contact Name","Website","Email","Linkback URL");
var checking = new Array("descr","title","fname","website","email","linkback");
TextCheck.check_it(checking,labels);
// Extra security to check again, make sure form is not submitted
var pass = TextCheck.validate(checking,labels);
//do form actions
//Strip HTML
&textarea name="adtxt" id="adtxt" rows="10" cols="70" onblur="TextCheck.stripHTML(this);"&&/textarea&
55.7k10121198
a workaround:
var temp = $("div").text("&");
var afterEscape = temp.html(); // afterEscape == "&"
&!doctype html&
&html lang="en"&
&meta charset="utf-8"&
&title&html&/title&
$(function() {
document.getElementById('test').innerHTML = "&";
&div id="test"&&/div&
you can simply convert special characters to html using above code.
As was mentioned by dragon the cleanest way to do it is with jQuery:
function HtmlEncode(s) {
return $('&div&').text(s).html();
function HtmlDecode(s) {
return $('&div&').html(s).text();
function escape (text)
return text.replace(/[&&\&\"\']/g, function(c) {
return '&#' + c.charCodeAt(0) + ';';
alert(escape("&&&'\""));
6,411125065
See JavaScript htmlentities
1,19911421
This doesn't direcly answer your question, but if you are using innerHTML in order to write text within an element and you ran into encoding issues, just use textContent, i.e.:
var s = "Foo 'bar' baz &qux&";
var element = document.getElementById('foo');
element.textContent =
// &div id="foo"&Foo 'bar' baz &qux&&/div&
7,42143669
Here's a good library I've found very useful in this context.
According to its author:
It supports all standardized named character references as per HTML,
handles ambiguous ampersands and other edge cases just like a browser
would, has an extensive test suite, and — contrary to many other
JavaScript solutions — he handles astral Unicode symbols just fine
1,47821237
Here are a couple methods I use without the need of Jquery:
You can encode every character in your string:
function encode(e){return e.replace(/[^]/g,function(e){return"&#"+e.charCodeAt(0)+";"})}
Or just target the main safe encoding characters to worry about (&, inebreaks, &, >, " and ') like:
function encode(r){
return r.replace(/[\x26\x0A\&&'"]/g,function(r){return"&#"+r.charCodeAt(0)+";"})
test.value=encode('How to encode\nonly html tags &&&\'" nice & fast!');
/*************
* \x26 is &ampersand (it has to be first),
* \x0A is newline,
*************/
&textarea id=test rows="9" cols="55"&&/textarea&
&script type="text/javascript"&
var str= "&\"'&&";
alert('B4 Change:\n' + str);
str= str.replace(/\&/g,'&');
str= str.replace(/&/g,'&');
str= str.replace(/&/g,'&');
str= str.replace(/\"/g,'&');
str= str.replace(/\'/g,'&#039;');
alert('After change:\n' + str);
use this to test:
Rakesh Juyal
Yes, but if you need to insert the resulting string somewhere without it being converted back, you need to do:
str.replace(/'/g,"&#39;"); // and so on
53.9k1072100
public static string HtmlEncode (string text)
using (StringWriter sw = new StringWriter())
var x = new HtmlTextWriter(sw);
x.WriteEncodedText(text);
result = sw.ToString();
Use the javaScript Function , that lets you encode strings.
escape("yourString");
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Post as a guest
By posting your answer, you agree to the
Not the answer you&#39;re looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enableddelphi7中copy((edit9.Text),1,2)=&#39;WZ&#39;什么意思?_百度知道
delphi7中copy((edit9.Text),1,2)=&#39;WZ&#39;什么意思?
提问者采纳
copy((edit9.Text),1,2)拷贝edit9.text里面的内容,从第一位开始,一共拷贝2位例如 edit9.text
里面的内容为
123456那么
copy((edit9.Text),1,2)
出来的结果就是
12你那整句应该是个判断语句里面的条件部分吧
提问者评价
谢谢您对我的帮助,我是初学者,真心感谢!
来自团队:
其他类似问题
为您推荐:
delphi7的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁前面流产了两次,现在怀孕一个月了,饮食方面需要注意什么&#476;1整天需要躺在床上_百度宝宝知道您的举报已经提交成功,我们将尽快处理,谢谢!
把63转换成二进制就明白了
大家还关注
(window.slotbydup=window.slotbydup || []).push({
id: '2081942',
container: s,
size: '1000,60',
display: 'inlay-fix'

我要回帖

更多关于 654476 016 的文章

 

随机推荐