English 中文(简体)
通过“(......)”和“(......)”通过《国际仲裁裁决汇编》造成403个错误,我如何加以编码?
原标题:Passing "(" and ")" through a URI causes a 403 error, how can I encode them?

(关于XML HTTP请求的Java 和用于执行QQ的PHP。)

I m 建造一个可进行查询的网站。 它使用XMLHTTP要求使用GET方法,并向执行该方法的PHP文字发出询问。 在我介绍括号内编码(<>>>(<>>>>>>>>/代码之前,该编码将予以罚款。

这方面的一个例子是:

function executeQry(){
qry = document.getElementByID( textarea ).value;
qryHTTPRequest(encodeURI(qry));
//I ve also tried encodeURIComponent(qry);
}


function xmlHTTPRequest(qry){
//fetches 
urlFetch = "http://my.url.com/script.php?qry=" + qry;
 }

这是一个快速的参考,我知道,我的xml-http://www.un.org/Depts/?

SELECT * FROM `tableName`

工作罚款,但当你试图做这样的事情时。

CREATE TABLE `new_table`
AS (SELECT * FROM `old_table`)

Then this is when it won t execute, I get the 403 error so I figured that it s an with the () because I even tried this same code on the PHP itself, without having to pass it through and it worked, so there must be an issue with the URL encoding process right? If this is the issue, is there a method for encoding these characters? I assume there are other characters that don t get encoded with encodeURI() method as well as the encodeURIComponent(). Thanks in advance!

最佳回答

如下:

urlFetch = "http://my.url.com/script.php?qry=" + encodeURIComponent(qry)
    .replace(/(/g, "%28").replace(/)/g, "%29");

父母在URI grammar中是单球。 很多公司将其视为特殊产品,即使其只有<>>>>>> 。 有了共同的网络议定书(,s, mailto),便可将其编码为%28%29。 虽然网络服务器被允许为其分配特殊意义。 页: 1 因此,你已经假定,URL越狱顺序是UTF-8。

RFC 3986:

sub-delims    "!" / "$" / "&" / " " / "(" / ")"
            / "*" / "+" / "," / ";" / "="

......

obsolete rule     translation
mark              "-" / "_" / "." / "!" / "~" / "*" / " "
                / "(" / ")"
问题回答

作为评论者,你有一些问题。 Brackets () and [] are valid in URIs, but have specific purpose hence they are not encode function.

Secondly, it is a really bad idea to send SQL over the wire, especially in a get request. See RFC 2616. Methods like get and head are considered safe , they should only implement retrieval, they are not meant to change state. I would really reconsider what you are doing and see if you could achieve it in a cleaner way, possibly seeking opinions on your conceptual architecture at Programmers.stackexchange.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.