HtmlEncode Local resources - asp.net

I have a web site that uses local resources. The main text (so not the labels, etc.) on de default page is stored in a file. This file is added to my local resources file default.aspx.fi-FI.resx and is named text-defaultPage. It's a regular text file with tags etc.
The problem is however, that the text is Finnish in other words it uses a lot of characters having umlaut (ä) and other special characters.
The person for whom the web site is wants to edit this text himself but he doesn't know anything about programming, html entities etc.
Is there a way to make it so that those characters are encoded with say htmlEncode?
in my Global.asax I check for the selected language and the page gets reload with that language.
Edit
Never mind, I made the files Unicode text files.

Solution to the problem is make the files unicode.

Related

How to open and doc file that has spaces between folder names

I have a file that will open perfect when the link is copied to a web browser but will fail when trying to open the link from the web page in asp.net. I noticed its because of the spaces. How can I get my application to read this space in between. The app fails to read Shared Documents due to the spacing and also Microsoft Word Test.docx. What can I add in-between the words that will read those spaces in asp.net so that I can open the docx file. Thanks in advance!
http://sharepoint/Shared Documents/Microsoft Word Test.docx
You can URL-encode the space character:
http://sharepoint/Shared%20Documents/Microsoft%20Word%20Test.docx
To do this dynamically in ASP.NET you'd likely use either HttpUtility.UrlEncode or WebUtility.UrlEncode.

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.

ASP.net webpages for multi Language support in caption texts

I am new for the ASP.net.
I have to build the web pages that will support Marathi language captions.
I am using DIV tag for viewing the text in English in .aspx file. Now these text is need to be replaced by Marathi text.
Please guide how can i do that.
Thank you.
Resource files (.resx) may help you. Store all texts in resource files, and categorize them for each language (for instance, on folder for each language).
Suppose you have a folder "en" and in that folder a resource file "myResourceFile.resx". Then you can read them as follows:
HttpContext.GetGlobalResourceObject("en/myResourceFile", "myDivText");

Arabic Locale Support in Flex

Today, I learn how to localize my Flex application and to support multiple languages. The tutorials on-line are great. However, non of them mention the Arabic locale.
So basically, I created the Arabic (Jordan) locale files in the SDK folder by using:
copylocale en_US ar_JO
I navigated to the locale folder and I was able to see the ar_JO folder in there... So I assume everything went smooth.
Next, I followed the tutorials (www.babelfx.org) and was able to localize my test application in English, French, and Arabic. Clicking on any of those languages switches the labels of my simple form/into the desired language... however:
When switching to the Arabic language the labels turn into empty square symbols. If you are wondering, yes I can open a notepad and type Arabic text and save it successfully.
When I type Arabic text into the text boxes, I can see the Arabic words that I typed correctly (the labels are still square symbols).
Any ideas what I might be missing here??
I tried changing the font of my application (right on the application tag I set the fontFamily) into Simplified Arabic which comes by default on Windows.
Thanks
Have you embedded a font into your swf which can render Arabic? Are you using that font? If the answer is no to either, then I suggest reading up on the subject.
One thing to remember about Flash and fonts is that it has incredible power which comes from the fact that one is able to embed actual fonts into the swf itself. One also needs to remember that Flash is incredibly finicky and is prone to throwing fits if you fail to do so.
The solution is to change the context-type to UTF-8. Three ways to accomplish this from within Flex Builder:
(Option 1) Right click the file from the File Navigator and select Properties
(Option 2) With the file open, navigate to the File menu and choose Properties
(Option 3) With the file open, press Alt + Enter to bring up the file Properties
Once the properties window is displayed, you will see the option to change the file encoding from Default to Other (UTF-8).
Note: At least for me, once I changed the content-type to UTF-8, I had to close my unsaved file, open it back up, and paste my contents back into the file in order to clear the error message. Then clean the project (Project -> Clean...) and let it rebuild.
I found the solution. Actually, I didn't have to embed any fonts or anything in order to get it working.
My problem was the encoding in the resources.properties file. I opened it in Notepad++, then I noticed the Encoding menu. At that time, I remembered reading something about that the encoding of the resources files should be UTF-8. So I converted the encoding to UTF-8 from the menu, compiled, it didn't work! After couple of retries and cleaning the project, it worked successfully!!!
Just a reminder for everybody (as I have fallen into this while working this problem out):
For mx components, embedded fonts must have the embedAsCFF set to false.

validate file type extension

How to prevent exe file upload in asp.net mvc.
If you are trying to prevent users uploading dangerous content, preventing them to upload exe files isn't enough. This is a black list approach. Much better is to ask yourself what are the valid file types you do support and block all others. This is a white list.
To allow certain file types you can check for the extension, but perhaps also validate the file header (the first couple of bytes from a file) to detect whether it is actually of the type you expect. You will have to figure out for each file type what the possible headers are.
Good luck.

Resources