encoding

Is the XML declaration tag case sensitive?

柔情痞子 提交于 2019-12-30 18:28:10
问题 I have what is probably a really simple, studid question but I can't find an answer to it anywhere and I need to be pretty sure about this. I have various XML files from various vendors. One of the vendors provide me an XML file with japanese characters in the file. Originally, I was having trouble processing the XML file (I'm using the MSXML SDK). The characters would come out wrong. I found that if the following was added to the XML file everything worked great. <?xml version="1.0" encoding

PHP file_exists with accent returns false

蓝咒 提交于 2019-12-30 18:06:59
问题 I have two folders, Folder and Folderé . The second one could not be catch by PHP. Here is my test: <?php $dir = 'D:\wamp\www\test\data\Folder'; var_dump(file_exists($dir)); // true $dir = 'D:\wamp\www\test\data\Folderé'; var_dump(file_exists($dir)); // false ?> How to fix it? 回答1: This works like charm <?php $dir = 'D:\wamp\www\test\data\Folderé'; var_dump(file_exists((utf8_decode($dir)))); 来源: https://stackoverflow.com/questions/19200750/php-file-exists-with-accent-returns-false

Converting arraybuffer to string : Maximum call stack size exceeded

你离开我真会死。 提交于 2019-12-30 17:39:23
问题 This is my line of code. var xhr = new XMLHttpRequest(); xhr.open('GET',window.location.href, true); xhr.responseType = "arraybuffer"; xhr.onload = function(event) { debugger; console.log(" coverting array buffer to string "); alert(String.fromCharCode.apply(null, new Uint8Array(this.response))); }; xhr.send(); That request is making to a pdf url which is around 3 MB in size. Read few thread with same error, telling that there must be some recursive call but I do not see any recursive call

Huffman encoding - header & EOF

孤街浪徒 提交于 2019-12-30 11:28:25
问题 I am currently working on implementing a program based on the huffman algorithm in Java, and I am at the stage where I need to output the encoded content to a file. I am a bit confused about how to implement the header and eof needed for decoding. For my header at the moment I have all the unique values that occur from the input file and their frequency, but on some articles I have seen people do it with 0 or 1 represents the nodes and then the frequency (which I am a bit puzzled by as it

ESAPI XSS prevention for user supplied url property

可紊 提交于 2019-12-30 10:10:59
问题 One of my REST APIs is expecting a property "url" which expects a URL as input from the user. I am using ESAPI to prevent from XSS attacks. The problem is that the user supplied URL is something like http://example.com/alpha?abc=def&phil=key%3dbdj The cannonicalize method from the ESAPI encoder throws intrusion exception here claiming that the input has mixed encoding, since it is url encoded and the piece '&phi' is treated as HTML encoded and thus the exception. I had a similar problem with

ESAPI XSS prevention for user supplied url property

╄→尐↘猪︶ㄣ 提交于 2019-12-30 10:09:06
问题 One of my REST APIs is expecting a property "url" which expects a URL as input from the user. I am using ESAPI to prevent from XSS attacks. The problem is that the user supplied URL is something like http://example.com/alpha?abc=def&phil=key%3dbdj The cannonicalize method from the ESAPI encoder throws intrusion exception here claiming that the input has mixed encoding, since it is url encoded and the piece '&phi' is treated as HTML encoded and thus the exception. I had a similar problem with

ASP.NET MVC3, Html.TextAreaFor without encoding?

旧时模样 提交于 2019-12-30 09:16:06
问题 How can I use the Html.TextAreaForwithout encoding it? I know it's a security risk but I have a separate class that sanitizes any text. Example: @Html.TextAreaFor(model =>model.PostBodyText, 10, 100, 1) I'm planning to use it with TinyMCE. Regards RaVen UPDATE I'm using the new Razor View Engine. 回答1: You will need to roll your own: <textarea cols="100" id="PostBodyText" name="PostBodyText" rows="10"> @MvcHtmlString.Create(Model.PostBodyText) </textarea> Of course in terms of security this

mysterious rails error with almost no trace

你离开我真会死。 提交于 2019-12-30 08:30:09
问题 We're having a strange problem with one crawler. Occasionally it will throw a Rails FATAL error on some request, but the trace is very limited and looks something like this [2014-07-01 18:16:37] FATAL Rails : ArgumentError (invalid %-encoding (c ^ FK+ 9u$_ t Kl ΥE! =k \ ̕* ߚ>c+<O یo ʘ> C R! 2 D (5 x q#!` 4 p |8 I E :+ H^9`^ # Vo{ > =[z )): lib/locale_middleware.rb:14:in `call' The crawler user-agent is Mozilla/5.0 (compatible; EasouSpider; +http://www.easou.com/search/spider.html) We can ask

Problems displaying French accented characters in UTF-8

两盒软妹~` 提交于 2019-12-30 08:23:09
问题 I'm working on a French language site built in CakePHP. I have tried multiple functions to try and convert the text into UTF-8 and display properly, but have had no success so far - any accented letters are displaying as a black diamond with a question mark. They do display correctly when I change the char set in the browser to ISO-8859-1, but I'd like to make the while site UTF-8 compliant. I have used: html_entity_decode($string, ENT_QUOTES, 'UTF-8'); htmlspecialchars($string, ENT_QUOTES,

How to encode quotes in HTML body?

元气小坏坏 提交于 2019-12-30 08:09:11
问题 Should I encode quotes (such as " and ' -> ” and ’ ) in my HTML body (e.g. convert <p>Matt's Stuff</p> to <p>Matt’s Stuff</p> )? I was under the impression I should, but a co-worker said that it was no big deal. I'm dubious but I can't find anything that says it is forbidden. Am I mistaken? Is it a best-practice to encode? Or is it simply useless? 回答1: Encoding quotation marks (") is in practice only needed if the're inside an attribute, however for the HTML code to be correct (passing HTML