encoding

Removing HTML entities in strings

时光毁灭记忆、已成空白 提交于 2020-02-02 04:11:32
问题 I have text that is retrieved on a linkbutton press: When I press the button I am getting the following returned: Test UAT's for release 2.2.0 It looks like HMTL entities are being retrieved. How do I turn these back into normal strings? 回答1: You don't need to remove the Html entities, actually the string that you are showing here is HTML Encoded so you just need to do Html Decoding to get it in normal form. For that you have HttpUtility.HtmlDecode method. string normalString = HttpUtility

Is a space possible in a base64 encoding?

蓝咒 提交于 2020-02-01 10:31:25
问题 Is it possible for a string generated from a base64 encoding to have a space (' ') in it? 回答1: No. Next question? http://en.wikipedia.org/wiki/Base64#Variants_summary_table Actually, spaces and CRLFs are usually silently skipped during the decoding, as they might appear as a result of splitting long strings. 回答2: By reading the http://en.wikipedia.org/wiki/Base64 wiki it seems that in Base64 transfer encoding for MIME (RFC 2045) spaces are allowed and discarded. In all other variants they are

Ajax call to return PDF file as base64 string

﹥>﹥吖頭↗ 提交于 2020-01-30 10:55:07
问题 Im using ajax in an angular js environment to called a local file (a pdf file). The called is successful, however the data return by the ajax call is in garbled code (not sure if i used the right term here, but is just like opening a pdf file using a text editor). Is there anyway that i could get the return result as base64 string? The reason behind this is to merge up with some of the existing pdf , but before that, i would need the base64 string of the pdf. Below are my ajax call code, $

Why does this encrypted string have funny characters in it? It isn't readable?

和自甴很熟 提交于 2020-01-30 09:50:13
问题 I'm converting the encrypted text using UTF8, yet the resulting string has funny characters that I can't read and not sure if I can send this text to the browser. string message = "hello world"; var rsa = new RSACryptoServiceProvider(2048); var c = new UTF8Encoding(); byte[] dataToEncrypt = c.GetBytes(message); byte[] encryptedData = rsa.Encrypt(dataToEncrypt, false); string output = c.GetString(encryptedData); Console.WriteLine(output); Console.ReadLine(); When I run the above, I get the

PHP HTML Decode

杀马特。学长 韩版系。学妹 提交于 2020-01-30 06:42:50
问题 I'm forced to work with HTML that looks like this: <font color=3D=22=236EAED2=22 style=3D=22font-siz= e:13px;font-family:arial;=22><B>Some Info Here</B></font></= A></td></tr><tr><td><font color=3D=22=23FFFFFF=22 style=3D=22font-size:11= px;font-family:arial;=22>192 Wellington Parade =7C Melbourne =7C VIC =7C= Australia 3002</font></td></tr><tr><td><font color=3D=22=23FFFFFF=22 st= yle=3D=22font-size:11px;font-family:arial;=22>T: 61-<a href=3D=22=23=22 s= tyle=3D=22color:=23FFFFFF; text

php mb_convert_encoding function doesn't work from ASCII to latin-1

可紊 提交于 2020-01-30 06:25:14
问题 //reencoding string from UTF-8 to Latin1 echo mb_detect_encoding($out); $out = mb_convert_encoding($out, mb_detect_encoding($out),"ISO-8859-1"); echo mb_detect_encoding($out); die; The result printed on my page is : ASCIIASCII I already checked the possible encoding supported (http://php.net/manual/fr/mbstring.supported-encodings.php) Latin-1 is knew as ISO-8859-1. But nothing changes... ---[EDIT]--- this is what I get when I print $out before the mb_detect_encoding(); My string is correct.

php mb_convert_encoding function doesn't work from ASCII to latin-1

╄→гoц情女王★ 提交于 2020-01-30 06:25:05
问题 //reencoding string from UTF-8 to Latin1 echo mb_detect_encoding($out); $out = mb_convert_encoding($out, mb_detect_encoding($out),"ISO-8859-1"); echo mb_detect_encoding($out); die; The result printed on my page is : ASCIIASCII I already checked the possible encoding supported (http://php.net/manual/fr/mbstring.supported-encodings.php) Latin-1 is knew as ISO-8859-1. But nothing changes... ---[EDIT]--- this is what I get when I print $out before the mb_detect_encoding(); My string is correct.

R: Encode character variables into numeric

我的梦境 提交于 2020-01-29 23:28:52
问题 In R code I have a character variable var that has values "AA", "AB", "AC", etc. str(var) chr [1:17003] "AA" "AA" "AA" "AA" "AB" "AB" ... How can I convert it to numeric variable so that "AA" would be coded as, e.g. 1, "AB" - as 2, etc. 回答1: You can convert the string to a factor and then to numeric. x <- c("AA", "AB", "AB", "AC", "AA", "XY") as.numeric(as.factor(x)) # [1] 1 2 2 3 1 4 Alternatively, you can use match and unique : match(x, unique(x)) # [1] 1 2 2 3 1 4 回答2: you can use them by

How do I display html encoded values in svg?

假装没事ソ 提交于 2020-01-28 10:55:05
问题 I am using d3 to generate svg and end up with markup similar to the following: <text class="rule" text-anchor="middle">&pound;10K</text> Compare to similar html that renders as expected. <div> £20,160 - £48,069 </div> Is there a property I need to set on the svg tag to get a similar type of encoding? I tried adding a meta tag to the page <meta name="content" content="application/xhtml+xml; charset=utf-8" /> but this did not work. 回答1: HTML entities are not defined in SVG. You can either use

Trying to understand zlib/deflate in PNG files

不羁的心 提交于 2020-01-28 05:45:06
问题 I'm currently in the middle of writing a small PNG image I/O library myself for learning purposes. My problem is the following: I created a small PNG only 2 by 2 pixels in dimension and opened it in a hex editor to study its contents. This is the image I created using GIMP and stored with a compression of "9". (Please note that this is an enlarged image of the original 2 by 2 pixel image ;) ) So I guess uncompressed, this would look something like this in memory: 00 00 00 FF 00 00 00 00 FF 00