Disable URL encoding - asp.net

Hello I'm not trying to use space or anything like that. all my urls are standard with dash separated words but the characters are in persian so instead of
/%D8%A2%D8%B1%D8%A7%DB%8C%D8%B4%DB%8C
I wanna see
/آرایشی
The links are already saved as the second one but when it shows it on webpage it automatically encodes it.
My CMS can handle getting requests like the second one and auto redirect. I've tried changing config file and some globalization settings but no luck yet.

Related

Asp.net adding weird encoded chars to url

i have this link with the url /laws/document?ref=S-AL1_2_36458.
when clicking on it, weird characters are being added. the characters are:
%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B
so the url will end being:
/laws/document?ref=S-AL1_2_36458%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B%E2%80%8B
when encoding the original link in js (using encodeURI()) it returns the same weird link. however, when encoding just the "ref value"
which is S-AL1_2_3645 it doesn't add weird chars
%E2%80%8B is URL encoded sequence for the Unicode character ZERO WIDTH SPACE (U+200B). This appears repeated 5 times in your URL.
So it seems, that the link isn’t actually just /laws/document?ref=S-AL1_2_36458 but it is /laws/document?ref=S-AL1_2_36458<ZWSP><ZWSP><ZWSP><ZWSP><ZWSP> which the browser will then encode properly in order to make the request. This behavior is expected and correct if that’s the actual URL that is being navigated to.
If this is not the URL that you want, I would suggest you to check the HTML of the link. If this is a static HTML, then check if there are any characters at the end of the URL and remove them. Since they are spaces of zero-width, they are effectively invisible but there are still there (e.g. in text editors, you will notice them when moving your cursor). If this is a generated link, check where the value comes from and try to trim any whitespace around the source.

Wordpress: uploading images with special characters gets the characters replaced

So, I have 2 sites. One in production, and the another in development. They have the same content and uploads.
In production, images with names containing æ, ø, or å gets the character replaced with something else, for example ø get replaced with ø, and then saved in the upload folder. And it works! Wordpress somehow gets the right image when I request it.
E.g: wp-content/upload/2015/01/interiørtips.jpg will display the image interiørtips.jpg.
In the database, the references to the images are saved normally, including the special characters; æøå is used in the name, not some other obscure character combination. This means that the database is ok.
I exported all the content from production to a fresh database in development, but now every image which has either an æ, ø, or å in it wont load the same way as in production. The request wp-content/upload/2015/01/interiørtips.jpg won't load anything, but wp-content/upload/2015/01/interiørtips.jpg will. This is opposite of the behavior in production.
Does anyone know anything about this?
EDIT: I'll probably just some rename tool. But, if anyone has any insights, please share.

Charset not working in .html but not .aspx

When I put this word "Bibliothèque" in a .aspx page, I see it correctly "Bibliothèque".
If I put the same word in a .html file, I see "Bibliothèque"
How can this be possible? Must be an IIS issue but I can't find the setting.
How can a .aspx file show the right word but not a .html file.
Open the file named web.config in the ASP.NET project. The value of requestEncoding attribute in globalization element is "utf-8". It means the requested texts were encoded as UTF-8 character set.
check your browser what it is support. you can change it using character encoding. So your HTML is giving you the result according to browser character encoding.
To ensure it will always work, for this specific example, you can replace the non ASCII characters using Html entities, like this: Bibliothèque. But this is not always practical in general.
Otherwise, there are other various ways to make it work:
use byte order mark encoding (sometimes called 'signature', or BOM, by editors) and save the file as UTF-8
add a META character encoding to your html file.
define what HTTP headers will be sent to the client using the globalization element in the application web.config (responseEncoding, etc.)
define what HTTP headers will be sent to the client using the ASP.NET #page directive
The best is to make sure all this is consistent in your application. UTF-8 support is now widespread, so it's a good choice as the encoding.
An interesting article on the encoding subject :The Definitive Guide to Web Character Encoding

Google Fonts CSS Include

Hey,
Since Google Fonts came out, I have had this question in mind. First see this below:
<link href='http://fonts.googleapis.com/css?family=Cantarell&subset=latin' rel='stylesheet' type='text/css'>
Here Google is linking to an external CSS file that doesn't have a file extension (.css)! Then Google also has another feature that if you want to inlude another font to this then just add the "|" sign and type the font name. How do you do this? Using Javascript, PHP or something?
Help is appreciated!
Thanks :)
The extension of a file does not have to mean anything at all about the contents of said file. It is merely a convention (one that Windows, for instance, uses to the point of making it seem like a requirement).
Any dynamic 'file' on a web site can return what ever kind of content it wants, any time it wants. The extension means nothing - aside from expected convention.
That URL could be a directory named css with a default 'document' that is a script, which handles the parameters to decide what content to give. Or, it could be a literal file named css which does the same thing. Or, it could not be a file or folder at all, instead merely part of a routing mechanism, which calls a controller based on the URL, and passes the parameters in.
Web servers return information in the response indicating what the MIME Type of the return value is, and the browser determines what to do with it based on that - not based on the extension of the file.
Yes, they have to be doing some sort of server-side processing when this URL is requested
http://fonts.googleapis.com/css
The querystring is parsed, and a text stream is returned with the CSS output. Allowing the user to add additional font families to the CSS is pretty trivial, as the server is just spitting back what you append to the query string.
You could do this in PHP or ASP.Net (and many others), but there is no indication of the underlying technology from Google's URL.
The easiest way to do this yourself would be to create a folder on your web server called "css", and then have a default script in there that does the processing. The URL could basically be almost identical to the Google url.

Specifying edit paths in Drupal for FCKEditor?

With the FCKEditor, you can specifiy paths where the editor must be included. Eg.
node/add/email
Which works great, until you need to go back and EDIT that node. Which means you end at a path like so:
node/284/edit
Now, the fck editor no longer works, because the path isn't valid.
Is there any way that one can get the FCKEditor to work for both the normal path and the edit path of ONE SPECIFIC CONTENT TYPE?
I'm not sure if you can do this with stock the FCKEditor module. However, you can do it by using the WYSIWYG API module, which allows you to specify WYWIWYG editors on a per-input-filter basis, and Better Formats, which allows you to set input filter formats on a per-node-type basis.

Resources