Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to handle URLs with brackets?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Forums Feedback
View previous topic :: View next topic  
Author Message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1415

PostPosted: Sat Apr 04, 2020 11:45 am    Post subject: How to handle URLs with brackets? Reply with quote

in my post
https://forums.gentoo.org/viewtopic-p-8439846.html#8439846
at the end there is an URL of the WHO site which I don't know how to handle correctly.
How to ?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 46352
Location: 56N 3W

PostPosted: Sat Apr 04, 2020 11:53 am    Post subject: Reply with quote

ulenrich,

Look at the ASCII character table.

Any printable character there can be replaced with %<hex>.
So '(' becomes %28

The ) is left as an exercise for the reader. :)
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1415

PostPosted: Sat Apr 04, 2020 12:29 pm    Post subject: Reply with quote

So, this dragon of an URL
https://www.who.int/news-room/detail/30-01-2020-statement-on-the-second-meeting-of-the-international-health-regulations- .....
becomes:
https://www.who.int/news-room/detail/30-01-2020-statement-on-the-second-meeting-of-the-international-health-regulations-%282005)-emergency-committee-regarding-the-outbreak-of-novel-coronavirus-%282019-ncov)

or my URL of the WHO

Code:

... seems not to work : ' % 2 8 ' for a bracket '('

quoting sign don't work either


Edit: %20 is the hex of decimal %40
I get it for the Gentoo forum with both sides %40 ( and ) %41
But the WHO site doesn't re-translate the ascii and give page not found

it is the hex and you must both

Edit2 : I try with hex not decimal
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 16011

PostPosted: Sat Apr 04, 2020 3:55 pm    Post subject: Reply with quote

You may also find man ascii useful as a local reference for character codes. Vim users can use ga to display the value of the character under the cursor. If you need to look up the codes of many characters at once, the tool xxd (from app-editors/vim-core) can produce a hex dump of its entire input.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6722

PostPosted: Sat Apr 04, 2020 8:40 pm    Post subject: Reply with quote

Just ctrl+c it from the browser url bar and it's encoded automatically.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Forums Feedback All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum