问题标签 [urlencode]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - python“'NoneType'对象没有属性'encode'”
我编写了这个小小的 Python 片段,它可以抓取提要并将其打印出来。当我运行代码时,提要中的某些内容会触发您在此处看到的错误消息作为我的问题。这是错误时的完整控制台输出:
java - 如何编码 URI 参数值?
我想发送一个 URI 作为查询/矩阵参数的值。在将其附加到现有 URI 之前,我需要根据 RFC 2396 对其进行编码。例如,给定输入:
http://google.com/resource?key=value1 & value2
我期望输出:
http%3a%2f%2fgoogle.com%2fresource%3fkey%3dvalue1%2520%26%2520value2
两者都java.net.URLEncoder
不会java.net.URI
产生正确的输出。URLEncoder
用于 HTML 表单编码,与 RFC 2396 不同。URI
没有一次编码单个值的机制,因此它无法知道 value1 和 value2 是同一个键的一部分。
java - java.net.MalformedURLException:URL 中有非法字符
我正在使用struts。我在一个应用程序中加密密码并通过打开的url连接将加密密码传递给另一个应用程序。有时如果我再次单击链接系统会抛出“java.net.MalformedURLException:非法字符在URL”。请帮帮我。
asp.net-mvc - 如何在 ASP.NET MVC 中不转义 URL 参数?
我注意到 Stackoverflow 登录/注销链接上的 returnurl URL 参数没有被转义,但是当我尝试将路径作为参数添加到路由时,它会被转义。
所以 /login?returnurl=/questions/ask 显示 /login?returnurl=%2fquestions%2fask 有点丑。如何让它不逃避 returnurl 值?
这是我在代码中所做的:
c# - UrlEncode - Javascript 与 C#
我有一个需要一些参数的 URL。这些参数的值可以是重音字符,所以我绝对需要对它们进行 UrlEncode。奇怪的是,我看到了行为或 Javascript 和 .NET 之间的差异。
假设我尝试对“éléphant”一词进行 UrlEncode。在 JavaScript 中(根据本网站:http ://www.albionresearch.com/misc/urlencode.php ),我得到以下信息:%E9l%E9phant。这对我来说似乎是正确的。但是,在 .NET 中使用此调用 (System.Web.HttpUtility.UrlEncode("éléphant")) 我得到“%c3%a9l%c3%a9phant”。怎么了?我错过了什么?如果我想在 .NET 中获取 %E9l%E9phant 该怎么办?
谢谢!
php - 如何使用 CURL 发送数组?我应该对其进行“urlencode”吗?
当我分配要作为 cURL 选项发布的数据数组时(通过 CURLOPT_POSTFIELDS),我是否需要先对该数据进行 urlencode 或将其处理?
c# - 使用 C# 进行 URL 编码
我有一个应用程序,它向 VB 论坛软件发送一个 POST 请求并让某人登录(不设置 cookie 或任何东西)。
用户登录后,我会创建一个变量,在他们的本地机器上创建一个路径。
c:\tempfolder\日期\用户名
问题是一些用户名抛出“非法字符”异常。例如,如果我的用户名是mas|fenix
它会抛出异常..
我不想从字符串中删除它,但是通过服务器上的 FTP 创建了一个带有用户名的文件夹。这引出了我的第二个问题。如果我在服务器上创建一个文件夹,我可以留下“非法字符”吗?我只问这个是因为服务器是基于 Linux 的,我不确定 Linux 是否接受它。
编辑:似乎 URL 编码不是我想要的。这就是我想要做的:
其中 %xx 是 ASCII 值或任何其他可以轻松识别字符的值。
asp.net-mvc - 如何避免 ASP.Net(或 IIS?)解码我的 URL 编码密文(导致 404)而不是将其传递给 Approve 脚本?
我正在 ASP.Net MVC 中开发一个 Web 应用程序,其中用户使用 sql 成员资格提供程序注册成员资格。当他们注册时,他们被放入系统但未被批准。然后,代码会向用户发送一封批准电子邮件,其中包含给定的电子邮件。
但是当用户点击链接时,他们会收到以下错误:
说明:HTTP 404。您要查找的资源(或其依赖项之一)可能已被删除、名称已更改或暂时不可用。请查看以下 URL 并确保其拼写正确。
请求的 URL:/Approve/k/9IHrY43os=
问题是,如果我在发送链接之前对链接进行 url 编码,为什么它会在尝试调用操作之前进行解码?当我收到错误时,我浏览器中的 url 实际上是 ' http://localhost:1091/Approve/k%2f9IHrY43os%3d '。我的路由设置正确,但它没有考虑 url 中加密字符串中的额外“/”(因为它不应该在那里。)
c# - URL-encoded slash in URL
My Map is:
If I use the URL http://localhost:5000/Home/About/100%2f200
there is no matching route.
I change the URL to http://localhost:5000/Home/About/100
then the route is matched again.
Is there any easy way to work with parameters that contain slashes? Other escaped values (space %20
) seem to work.
EDIT:
To encode Base64 works for me. It makes the URL ugly, but that's OK for now.
EDIT1:
At the end it turned out that the best way was to save a nicely formated string for each item I need to select. Thats much better because now I only encode values and never decode them. All special characters become "-". A lot of my db-tables now have this additional column "URL". The data is pretty stable, thats why I can go this way. I can even check, if the data in "URL" is unique.
EDIT2:
Also watch out for space character. It looks ok on VS integrated webserver but is different on iis7 Properly url encode space character
asp.net - Server.UrlEncode 与 HttpUtility.UrlEncode
Server.UrlEncode 和 HttpUtility.UrlEncode 有区别吗?