If we look at a specific page the problem is occuring:
http://www.completeofficechairs.co.uk/RH%20Extend%20220
Where there are meant to be spaces, its showing %20.
So instead of http://www.completeofficechairs.co.uk/RH%20Extend%20220 its meant to be:
http://www.completeofficechairs.co.uk/RH Extend 220
How do I stop this?
Im on an apace web server, so could it be a htaccess mod?
Spaces are not allowed in URLs. They have to be escaped (their escape character is %20). I don't think there is any way to accomplish what you are trying to do.
Do not use spaces or replace them with underscores _ or dashes -. Your url will look better and be human-readable:
http://www.completeofficechairs.co.uk/RH-Extend-220
Related
I'm having some issues with a few 301 redirects in htaccess. The original filenames/URLs were given special characters that I'm not quite sure how to properly escape. The URLs are structured like:
company%E2%80%99s-person-of-interest-aman%E2%80%99s-most-prestigious-%E2%80%9Cacademy-of-leaders-award%E2%80%9D
which equates to:
company’s-person-of-interest-aman’s-most-prestigious-“academy-of-leaders-award”
I've tried some things like
company\'-person-of-interest-aman\'s-most-prestigious-\"Cacademy-of-leaders-award\"
but that didn't work. What am I missing?
This is a UTF-8 character, which doesn't equate to \' or \" on the server side because ' and ’ are different characters according to the encoding spec. You could do one of two things:
1) You could simply rename the files, substituting the ASCII compatible characters for the UTF-8 ones
2) Use the percent encoded values in your redirect string directly.
Instead of
company\'-person-of-interest-aman\'s-most-prestigious-\"Cacademy-of-leaders-award\"
do
company%E2%80%99s-person-of-interest-aman%E2%80%99s-most-prestigious-%E2%80%9Cacademy-of-leaders-award%E2%80%9C
EDIT: while writing the answer, I also realized that your original expression for the redirect url isn't quite matching up even if your characters were ASCII:
company\'-person-of-interest-aman\'s-most-prestigious-\"Cacademy-of-leaders-award\"
should be
company\'s-person-of-interest-aman\'s-most-prestigious-\"academy-of-leaders-award\"
How do I get Special Characters to show up in Apache Velocity as a string?
something like:
#include(" <Bundle>")
#include(" <Description>$!{bundle.description}</Description>")
#include(" </Bundle>")
you can use velocity escape tool.
https://velocity.apache.org/tools/devel/generic/EscapeTool.html
I took out the includes and it wrote it all as I needed it.
I have a big string, precisely - an XSLT code - that I would like to hardcode in my VB.net program. I tried with putting " before every quotation mark, but it still didn't work out, and it's pretty mocking to place it 100 times. Using Chr(34) is also not the best solution.
Is there some way, like to put # (or another character) before the string itself that will define and work for all the characters in the string that need to be escaped ?
If it is a large string. Why not save it to file and then read the file into memory before you want to use it. That way you don't have to do any escaping and it will be easy to modify if you decide to change it.
All the URLs ending with % is giving following error
"Bad Request,Your browser sent a request that this server could not understand."
I have redesigned my website and earlier as per my google analytics URLs ending with % was running.
I want to mention that I tried using same old htaccess but was not able to fix it. Other important change which I made was in hosting where I have pointed my server into a sub folder or the root.
Please help me in fixing it
% is a reserved character and should not be used for anything except percent encoding.
If you really need to pass the character on your url, use %25
Try this: 400 Bad Request when URL ends with %
(move your mouse over it and look at the URL, it's the URL of this page with a % added to it!)
The problem is probably that the % is used as an escape character for special signs like spaces or non latin characters, and the browser expects a code behind it.
Im doing some screen scraping and im getting back a string that appears to end with whitespace but neither string.strip or strip.gsub(/\s/u, '') removes the character.
Im guessing it's a character encoding issue. Any suggestions?
I think, there are a lot of "space characters".
You can use something like this:
my_string.gsub("\302\240", ' ').strip
You can try this: my_string.gsub(/\A[[:space:]]+|[[:space:]]+\z/, '')
This should remove all space characters from the beginning and the end of string, including all possible unicode space variations.
Figure out the character code of the last character (str[-1].ord) and explicitly search and destroy it. Rinse/repeat if there exist more unwanted characters after that. After doing this, report back here what the invisible character was. (Perhaps it's only invisible because the font you are using does not have that glyph?)