标签: urlencode

是否可以对包含网址编码网址的网址进行urlencode?

我有一个网站,使用Facebook,Twitter,美味的分享链接.它们包含您希望共享的网站的url编码网址.问题是我想通过php重定向页面发送facebook/twitter/delicious url.

它会在编码的网址中编码网址吗?会有副作用吗?

为了简化我的问题:

www.website.com/redirect.php?url=" URLENCODED (http://www.facbook.com/sharer.php?t='URLENCODED(title)'&u='URLENCODED(http://www.hotel.com)')
Run Code Online (Sandbox Code Playgroud)

php urlencode

5
推荐指数
1
解决办法
5411
查看次数

令人困惑的python urlencode命令

好的,所以根据http://docs.python.org/library/urllib.html

"编码字符串中的参数顺序将与序列中参数元组的顺序相匹配."

除非我尝试运行此代码:

import urllib
values ={'one':'one',
         'two':'two',
         'three':'three',
         'four':'four',
         'five':'five',
         'six':'six',
         'seven':'seven'}
data=urllib.urlencode(values)
print data
Run Code Online (Sandbox Code Playgroud)

输出为......

seven=seven&six=six&three=three&two=two&four=four&five=five&one=one
Run Code Online (Sandbox Code Playgroud)

7,6,3,2,4,5,1?

这看起来不像我的元组的顺序.

python urlencode

5
推荐指数
2
解决办法
4139
查看次数

æøå的Python urllib urlencode问题

如何用特殊字符urøå对一个字符串进行urlencode?

恩.

urllib.urlencode('http://www.test.com/q=testæøå')
Run Code Online (Sandbox Code Playgroud)

我收到这个错误:( ..

不是有效的非字符串序列或映射对象

python urllib urlencode

5
推荐指数
2
解决办法
1万
查看次数

有没有办法在lxml中禁用锚属性的urlencoding

我正在使用lxml 2.2.8并尝试将一些现有的html文件转换为django模板.我唯一的问题是lxml urlencodes锚名称和href属性.例如:

<xsl:template match="a">
<!-- anchor attribute href is urlencoded but the title is escaped -->
<a href="{{{{item.get_absolute_url}}}}" title="{{{{item.title}}}}">
    <!-- name tag is urlencoded -->
    <xsl:attribute name="name">{{item.name}}</xsl:attribute>
    <!-- but other attributes are not -->
    <xsl:attribute name="nid">{{item.nid}}</xsl:attribute>
    <xsl:attribute name="class">{{item.class_one}}</xsl:attribute>
    <xsl:apply-templates/>
</a>
Run Code Online (Sandbox Code Playgroud)

像这样产生html:

<a href="%7B%7Bitem.get_absolute_url%7D%7D"  
   title="{{item.title}}" name="%7B%7Bitem.name%7D%7D" 
   nid="{{item.nid}}" class="{{item.class_one}}">more info</a>
Run Code Online (Sandbox Code Playgroud)

我想要的是这个:

<a href="{{item.get_absolute_url}}">more info</a>
Run Code Online (Sandbox Code Playgroud)

有没有办法禁用lxml正在做的(自动)urlencoding?

这里(基本上)是我用来生成和解析文件的代码:

from lxml import etree, html
from StringIO import StringIO

doc = StringIO(
'''<html>
<head>
    <title>An experiment</title>
</head>
<body>
<p class="one">This is an interesting paragraph detailing …
Run Code Online (Sandbox Code Playgroud)

python xslt lxml urlencode

5
推荐指数
1
解决办法
1572
查看次数

产生网址安全数据的压缩算法

我希望以紧凑的形式存储Cookie数据。

是否存在产生URL安全输出的压缩算法之类的东西?目前我的方法是

String jsonData = GSON.toJson(data);
byte[] cookieBinaryData = jsonData.getBytes("UTF-8");
byte[] cookieSnappyData = Snappy.compress(cookieBinaryData);
String cookieBase64Data = new Base64(true).encodeToString(cookieSnappyData);
Run Code Online (Sandbox Code Playgroud)

cookieBase64Data是存储在cookie中的一个。我很乐意跳过Base64跃点。

compression algorithm cookies urlencode character-encoding

5
推荐指数
1
解决办法
1213
查看次数

为什么url-encoding在域破坏url之后的第一个斜杠?

Salvete!我发现某种url编码方式打破了链接.记录%2f代表正斜杠字符:/

现在,考虑一下:原始链接: http://dottech.org/95285/this-is-the-pacific-barreleye-a-fish-with-a-transparent-head-amazing-photo-of-the-day

javascript(encodeURIComponent)urlencoded链接:http://dottech.org%2f95285%2fthis-is-the-pacific-barreleye-a-fish-with-a-transparent-head-amazing-photo-of-the-day

现在,如果您将编码的链接粘贴到浏览器的地址栏中,它就会被破坏(Firefox,Chrome,IE).

但是,如果你没有对第一个正斜杠进行url编码,它就可以完美地运行:http://dottech.org/95285%2fthis-is-the-pacific-barreleye-a-fish-with-a-transparent-head-amazing-photo-of-the-day

为什么?

javascript url urlencode hyperlink

5
推荐指数
1
解决办法
2494
查看次数

不支持网址编码

我有在线档案.我正在尝试使用它media player using live streaming.但媒体播放器给出了一个error (-1,1004) 我认为我的媒体播放器没有得到正确的URL,因为它包含阿拉伯字符,所以我尝试使用Html.encode或UrlEncoder类编码它仍然得到相同的错误.

所以最后我在webview中加载了这个url,在页面加载完成后我将网页url传递给了媒体播放器.

    WebView webView = new WebView(SongActivity.this);
        webView.setSoundEffectsEnabled(false);
        webView.loadUrl("MY URL");
        webView.setWebViewClient(new WebViewClient() {
            public void onPageFinished(WebView view, String url) {

                try {

                playerService.startPlay(url );// this passes url to media player and url will be played using media player

                } catch (IllegalArgumentException e) {
                    e.printStackTrace();
                } catch (IllegalStateException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

            };

            public void onPageStarted(WebView view, String url,
                    android.graphics.Bitmap favicon) {
                System.out.println("Decoding url:" …
Run Code Online (Sandbox Code Playgroud)

android http urlencode android-mediaplayer

5
推荐指数
1
解决办法
1155
查看次数

使用有效URL从客户端(?)检测到潜在危险的Request.Path值

我有几个星期在IIS 7.5上运行的ASP.NET MVC 4 Web应用程序,我注意到最近我遇到了很多以下错误:
System.Web.HttpException (0x80004005): A potentially dangerous Request.Path value was detected from the client (?). at System.Web.HttpRequest.ValidateInputIfRequiredByConfig() at System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)

我知道当URL路径包含非法时会导致此异常字符,但奇怪的是,在我的情况下,URL是有效的.以下是URL的一个示例:www.mysite.com/myApp/bookTitle?chapter=12&page=278.

但是,当我尝试任何报告的链接时,它们工作正常,没有任何例外.

通过查看错误日志,我注意到查询字符串不显示为QUERY_STRING变量的一部分,但它与PATH_INFO变量中的其余路径一起包含,如下所示:
/myApp/bookTitle?chapter=12&page=278.所以似乎(?)不被识别为路径和查询之间的分隔符(可能是因为某种URL编码)但我不知道如何解决这个问题.

任何帮助将不胜感激.

c# urlencode .net-4.0 iis-7.5 asp.net-mvc-4

5
推荐指数
1
解决办法
1万
查看次数

ImportError:尝试安装flask.ext.storage时无法导入名称'urlencode'

我正在使用Python 3.5.1/Window 8.1

>> pip install -e git://github.com/kvesteri/flask-storage.git#egg=Flask-Storage

这是结果:

Obtaining Flask-Storage from git+git://github.com/kvesteri/flask-storage.git#egg=Flask-Storage
  Updating c:\users\rodolfo\desktop\dumppython\flask\venv\src\flask-storage clone
Requirement already satisfied: Flask>=0.7 in c:\users\rodolfo\desktop\dumppython\flask\venv\lib\site-packages (from Flask-Storage)
Requirement already satisfied: boto>=2.5.2 in c:\users\rodolfo\desktop\dumppython\flask\venv\lib\site-packages (from Flask-Storage)
Collecting python-cloudfiles>=1.7.10 (from Flask-Storage)
  Using cached python-cloudfiles-1.7.11.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Rodolfo\AppData\Local\Temp\pip-build-t2cefnr2\python-cloudfiles\setup.py", line 6, in <module>
        from cloudfiles.consts import __version__
      File "C:\Users\Rodolfo\AppData\Local\Temp\pip-build-t2cefnr2\python-cloudfiles\cloudfiles\__init__.py", line 82, in <module>
        from cloudfiles.connection     import Connection, ConnectionPool
      File "C:\Users\Rodolfo\AppData\Local\Temp\pip-build-t2cefnr2\python-cloudfiles\cloudfiles\connection.py", …
Run Code Online (Sandbox Code Playgroud)

pip urlencode python-3.x flask-extensions

5
推荐指数
1
解决办法
5550
查看次数

在Angular 5中发布形式urlencoded

我正在尝试使用Spring后端和Angular 5前端开发应用程序.对于登录我使用的是Spring Security,在前端我试图将登录数据发布为x-www-form-urlencoded.但是后端的用户名和密码都是null.Angular 5文档HttpClient仅提供了发布json数据的示例,并且Http已弃用.

任何有关如何解决这个问题的建议将不胜感激.

这是我的Angular代码:

constructor(public httpClient: HttpClient) {
    console.log('Hello RestService Provider');
}

login(username: string, password: string) {
    var body = 'username=' + username + '&password=' + password + "&remember-me=" +  false;
    var headers = new HttpHeaders();
    headers.append('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
    let options = {headers: headers, withCredentials: true};
    this.callPostWithOptions("login", body, options).then(data=>{
      this.getCurrentUser();
    });
}

callPostWithOptions(address, body, options) {
    return new Promise(resolve => {
      address = this._SERVER_HOST + ":" + this._SERVER_PORT + "/" + address; …
Run Code Online (Sandbox Code Playgroud)

rest spring urlencode angular

5
推荐指数
1
解决办法
2522
查看次数