How to set URL encoded hyperlinks in libre office? - openoffice.org

Want to set a hyperlink containing deliberately an URL encoded (aka percent encoded) hash '#' in libre office Version 4.0.3.3 . This should be done by inserting an '%23', but whenever I save this URL it seems to be rewritten to a '#' - which breaks this URI.
So, how to set an percent encoded character in libre office?

I found a workaround: in the hyperlink dialog, do not choose internet but document and paste your url encoded URI into the path field, click ok - and voila.

Related

why routes with % character in routes will display blank?

in rails when the routes or url has % will display blank page.
e.g www.domain.com/% ---- will display blank page
I check also some website like github.com/% but still display in blank page.
It is related to URL Encoding. In short.
URL encoding converts characters into a format that can be transmitted
over the Internet.
Then we have some basic terminology you might wish to know
URL - Uniform Resource Locator
Web browsers request pages from web servers by using a URL.
The URL is the address of a web page, like https://stackoverflow.com/
URL Encoding (Percent Encoding)
URLs can only be sent over the Internet using the ASCII character-set.
Since URLs often contain characters outside the ASCII set, the URL has
to be converted into a valid ASCII format.
URL encoding replaces unsafe ASCII characters with a "%" followed by
two hexadecimal digits. URLs cannot contain spaces. URL encoding
normally replaces a space with a plus (+) sign or with %20.
Well, so when your route contains only %, it was recognized as the encoded string but it missed two hexadecimal digits followed so you will always get a blank page or a custom error page depends on how your site was configured.
Because browser will request to https://stackoverflow.com/% and it is not existing.
How to handle it
Basically, If your URL is in unwell format when requesting to the server. It will return you an HTTP 400 error code which means
10.4.1 400 Bad Request
The request could not be understood by the server due to malformed
syntax. The client SHOULD NOT repeat the request without
modifications.
So what we need to do is just doing configuration on the server to redirect to a custom error page (in this case IIS Web Server of ASP.NET website). Example can found here

hash tags in urls and hyperlinks

I created a hyperlink to a file. the file name contains hashtags as a means to separate information.
<div style="height:100%;width:100%">.</div>
translated to...
http://localhost/dir/upload/1427853638#0#file#A101.pdf
Is this a "legal" name in a URL? Im getting a "file not found" error
The requested URL /dir/upload/1427853638 was not found on this server.
So, clearly the # has another meaning in the URL (I understand now, its a location hash property). Is there a way to get this to work, or do i need to use another character besides the # in the file names?
Since # is a special character in the URL semantic (it's used to provide an internal anchor in a HTML page), it should be URL-encoded into %23.
Your URL should be: http://localhost/dir/upload/1427853638%230%23file%23A101.pdf.
NB: you can find an online URL encoder here: http://meyerweb.com/eric/tools/dencoder/

how to pass URL with whitespace in Chrome and IE or include whitespace without encode?

I have a url to pass on my website that have whitespace. what thing i should done that chrome and IE never encode them. suppose
Mywebsite.com/search/ASP.NET MVC 2
IE and chrome fill whitespace with %20 how i can stop them to do this type of things.
You can replace the whitespace with "_" - this is a pretty normal case. But you will probably not be able to keep your spaces.
Whitespaces are not allowed in URLs. That is why they can automatically encoded by some browser if you call that page directly.
What's the problem with that encoding on the receiver side? Just decode the data or (if you are sure there were only whitespaces) just replace all %20 with a whitespace.

browser url encoding different that java's URLEncoder.encode

I have a url like this:
product//excerpts?feature=picture+modes
when i access this url from browser, the backend receives the request as:
"product//excerpts?feature=picture+modes"
At the web server end, i am using + as a separator. so feature=picture+modes means there are 2 features: picture and modes
I have created and automated script(Java) which goes to the url and retrieves its content.
When i run this script, the backend receives the request as:
"product/B000NK6J6Q/excerpts/feature=picture%2Bmodes"
This is because inside my script(Java) i use URLEncoder.encode which converts + to %2B and send this encoded url to the server.
Why are the urlEncoders provided by Java and those present with browsers(FF/IE) different.
how do i make them same? How do i decode them? ('+' on URLDecoder.decode gives space)
Also, is using '+' as a separator according to conventions (and specifications?) ?
Prac
What you are seeing is actually correct. See Percent encoding on Wikipedia. The + character is a reserved character and therefore needs to be encoded as %2B. Furthermore, historically browsers use a different form of percent encoding for forms that are submitted with the MIME type application/x-www-form-urlencoded where spaces become + instead of %20.
If you want to use a + in the URL then your separator should be a space in the backend. If you want to use + in the backend, then you will have %2B in the URL.

Properly url encode space character

I use HttpUtility.UrlEncode to encode any value that is used in a route.
I already solved an issue with encoding forward slashes. The new problem I have now is with spaces. A space is encoded as + .
This works on the VS integrated Webserver, but I have an issue with it in IIS7 on Windows Server 2008.
If I have the URL http://localhost/Home/About/asdas+sdasd
I get the error 404.11 - Request contains double escape sequence.
I know I can just replace the space by "%20", but I dont want to care about propper encoding myself. Is there any ready to use UrlEncoder for MVC out there?
' ' encoded to %20 use HttpUtility.UrlPathEncode.
Any URL Encoding is most often designed to work on the path component of the url, the reason because different schemes have different characters in the safe list. Look for your libraries urlencoder and just use it in the path and above portion of the url.
#HttpUtility.UrlPathEncode(path)
UrlPathEncode just encodes the path of the Url, rather than encoding the whole Url.

Resources