Support for special characters in URLs

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Support for special characters in URLs

Post by Little John »

The following snippet shows, that PB's function GetHTTPHeader() does not work with a so called "Umlaut-Domain", even when it is percent-encoded. The same issue probably exists with other functions of the HTTP library (not tested).

Code: Select all

; e.g. PB 5.62 and PB 5.70 beta 1 on Windows

InitNetwork()

Debug GetHTTPHeader("https://www.purebasic.com/")   ; OK
Debug GetHTTPHeader("https://post-ärger.de")        ; -> "" (works e.g. with Firefox, though)
Debug GetHTTPHeader("https://post-%C3%A4rger.de")   ; -> "" (works e.g. with Firefox, though)
Debug "Finished."
After Punycode encoding, it works as expected:

Code: Select all

; e.g. PB 5.62 and PB 5.70 beta 1 on Windows

InitNetwork()

Debug GetHTTPHeader("https://xn--post-rger-z2a.de")   ; OK
Debug "Finished."
Punycode encoding is what browsers do internally with internationalized domain names.
I wish the functions in PB's HTTP library would do that, too. Thanks for considering it.
User avatar
Mijikai
Addict
Addict
Posts: 1517
Joined: Sun Sep 11, 2016 2:17 pm

Re: Support for special characters in URLs

Post by Mijikai »

+1
User avatar
Sicro
Enthusiast
Enthusiast
Posts: 559
Joined: Wed Jun 25, 2014 5:25 pm
Location: Germany
Contact:

Re: Support for special characters in URLs

Post by Sicro »

+1
Image
Why OpenSource should have a license :: PB-CodeArchiv-Rebirth :: Pleasant-Dark (syntax color scheme) :: RegEx-Engine (compiles RegExes to NFA/DFA)
Manjaro Xfce x64 (Main system) :: Windows 10 Home (VirtualBox) :: Newest PureBasic version
Post Reply