url-encoding

Why does PHP built-in web server not serve file called é.txt (on Windows)

一世执手 提交于 2019-12-06 07:28:18
I'm on Windows 7 If I have a directory containing my file é.txt and I start the built-in web server in that directory php -S localhost:8000 then, using my web browser, I request the URL http://localhost:8000/é.txt the web server responds Not Found The requested resource /%C3%A9.txt was not found on this server. Alastair McCormack PHP's Windows filesystem support is broken - it does not properly translate to the native encoding. See How do I use filesystem functions in PHP, using UTF-8 strings? 来源: https://stackoverflow.com/questions/33150112/why-does-php-built-in-web-server-not-serve-file

AngularJS route parameters with any characters

蹲街弑〆低调 提交于 2019-12-05 22:51:27
问题 I am new to AngularJS, so forgive me if this is obvious, but I am looking for someone who can answer this tricky question. I am implementing an application, and need to pass some parameters to a particular view to display details about a book. Basically I would like to be able to use the following routing expressions: bookApp.config(['$routeProvider', function($routeProvider) { $routeProvider. when('/catalog', { templateUrl: 'cataloglist.htm', controller: 'catCtrl' }). when('/book/:title/

URL decoding in Java for non-ASCII characters

蓝咒 提交于 2019-12-05 19:42:14
I'm trying in Java to decode URL containing % encoded characters I've tried using java.net.URI class to do the job, but it's not always working correctly. String test = "https://fr.wikipedia.org/wiki/Fondation_Alliance_fran%C3%A7aise"; URI uri = new URI(test); System.out.println(uri.getPath()); For the test String " https://fr.wikipedia.org/wiki/Fondation_Alliance_fran%C3%A7aise ", the result is correct "/wiki/Fondation_Alliance_française" (%C3%A7 is correctly replaced by ç). But for some other test strings, like " http://sv.wikipedia.org/wiki/Anv%E4ndare:Lsjbot/Statistik#Drosophilidae ", it

Indy TIdHTTP URI with login/password not working

帅比萌擦擦* 提交于 2019-12-05 06:17:52
问题 I'm writing an HTTP API wrapper to integrate with particular IP Cameras. Part of the process requires login credentials in the URI, for example: http://user:pass_with_#_sign@address:port/somespecificpath/ I'm using Indy's TIdHTTP.Get to send the request to the device. However, the password consists of a '#' character. If this URI is placed in any browser with the plain password, the # character throws it off. Therefore, I need to encode the password's # to %23 ... http://user:pass_with_%23

Why do I have to URI.encode even safe characters for Net::HTTP requests?

怎甘沉沦 提交于 2019-12-05 06:05:31
I was trying to send a GET request to Twitter (user ID replaced for privacy reasons) using Net::HTTP: url = URI.parse("http://api.twitter.com/1/friends/ids.json?user_id=12345") resp = Net::HTTP.get_response(url) this throws an exception in Net::HTTP: NoMethodError: undefined method empty?' for #<URI::HTTP:0x59f5c04> from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:1470:in initialize' just by coincidence, I stumbled upon a similar code snippet, which used URI.encode prior to URI.parse , so I copied that and tried again: url = URI.parse(URI.encode("http:/

How to use Google's Text-to-Speech service for Chinese characters on Android?

白昼怎懂夜的黑 提交于 2019-12-05 05:26:30
I'm trying to pull an audio file from google's text-to-speech function. Basically, you toss in the link and then concat whatever you want to be spoken at the end of it. I've gotten the below code to work just fine for English, so I think the problem must be how the Chinese characters are getting encoded in the request. Here's what I've got: String text = "text to be spoken"; public static final String AUDIO_CHINESE= "http://www.translate.google.com/translate_tts?tl=zh&q="; public static final String AUDIO_ENGLISH = "http://www.translate.google.com/translate_tts?tl=en&q="; URL url = new URL

php file_get_contents($url) & turns into &

梦想的初衷 提交于 2019-12-05 03:09:55
I am trying to make a request to the coinbase api like this $url = "https://api.gdax.com/products/BTC-USD/candles?start=".date($format,$starting_date)."&end=".date($format,$ending_date)."&granularity=".$granularity; and then I pass that in file_get_contents($url) but it gives me an error file_get_contents( https://api.gdax.com/products/BTC-USD/candles?start=2015-05-07&end=2015-05-08&granularity=900 ): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request. The problem of course is when the '&' gets changed into '&'. Ilgıt Yıldırım It seems you need define an user agent. Try this;

C# Start a new MailTo Process and HTML URL Encoding

二次信任 提交于 2019-12-04 20:13:30
I have created a new MailTo extension method for the Process class which just fills the Process with a new ProcessStartinfo which contains the required mailto arguments. I have created a method called FormatMailToArgument (Right at the end) which converts control characters to their Url Encoded equivelants and have tested this and it works but is there a better way of doing this? /// <summary> /// <see cref="Process"/> extension methods. /// </summary> public static class Processes { #region MailTo /// <summary> /// Populates the process with mailto <see cref="ProcessStartInfo"/>. You may

mod_rewrite rule to enforce canonical percent-encoding

寵の児 提交于 2019-12-04 14:29:50
We have a PHP app with a dynamic URL scheme which requires characters to be percent-encoded, even " unreserved characters " like parentheses or aphostrophes which aren't actually required to be encoded. URLs which the app deems to be encoded the "wrong" way are canonicalized and then redirected to the "right" encoding. But Google and other user agents will canonicalize percent-encoding/decoding differently, meaning when Googlebot requests the page it will ask for the "wrong" URL, and when it gets back a redirect to the "right" URL, Googlebot will refuse to follow the redirect and will refuse

AngularJS route parameters with any characters

天大地大妈咪最大 提交于 2019-12-04 04:22:37
I am new to AngularJS, so forgive me if this is obvious, but I am looking for someone who can answer this tricky question. I am implementing an application, and need to pass some parameters to a particular view to display details about a book. Basically I would like to be able to use the following routing expressions: bookApp.config(['$routeProvider', function($routeProvider) { $routeProvider. when('/catalog', { templateUrl: 'cataloglist.htm', controller: 'catCtrl' }). when('/book/:title/:chapter', { template: 'chapterdetail.htm', controller: 'chapterCtrl' }). otherwise({ template: 'oops ...