I have an application web.xml with the following entry:
<error-page>
<error-code>404</error-code>
<location>/system_files/error/p_notfound.jsp</location>
</error-page>
However, when this page is displayed, Japanese characters are garbled.
The same page (p_notfound.jsp) displays properly if displayed directly or even through the servlet filter.
I tried adding a filter to:
request.setCharacterEncoding("UTF8");
But that doesn't help. Any ideas?
I tried the suggestion above, but I actually fixed this by adding the response header to force it through the servlet filter:
response.setHeader("Content-Type", "text/html; charset=UTF-8");
Seems to work just fine!
I have experienced this problem too. I resolved it by upgrading. Are you using the latest version of Tomcat?
Using request.setCharacterEncoding() won't help you since it justs changes the encoding used to parse request parameters.
You should check this:
Is the JSP content really UTF-8 encoded?
Have you set an pageEncoding parameter for your JSP Page?
Related
I have an application on Apache. My Apache is configured with default encoding ISO-8859, and I´m not able to change it because Apache suport others applications that need this.
Then, in my application I´m using numerical HTML encoding in special characters, like that: Usu& #225;rio (this is Usuário).
It´s working fine, but in placeholders and title (HTML5 elements), the interface is showing á ; instead to show á.
Any idea?
Thanks
You could rename your .html file to .php and add following line to the first row:
<?php header('Content-Type:text/html; charset=UTF-8'); ?>
This will send a response from server that the content which is sent is encoded in utf-8.
By adding above code nothing will be broken and you wont see any difference exept for correct encoding.
In case you need to move the site from one server to another, you can undo those steps and everything will still work as expected.
It tried to reproduce your issue with the given HTML entity and placeholder encodes the character correctly.
Resolved. I used unicode code point instead numerical HTML encoding. Take a look at UTF-8 encoding table and unicode characters here.
I use MvxImageView with a binding to ImageUrls with the following format:
http://mysite/service/service.svc/rest/Image/flag/<picture size>/country/<Country ID>
an example would be:
http://mysite/service/service.svc/rest/Image/flag/48/country/104
http://mysite/service/service.svc/rest/Image/flag/48/country/141
which returns a 48x48 pixel image of the Swiss flag in png format for the first link and a Spanish flag for the second link.
Does MvxImageView or any of its helpers depend on a unique filenames including an file extension?
Or could even the "service.svc" be the problem and be interpreted as the filename?
According to the webserver logs the App doesn't even open the Url. When I tried with another picture from another server it worked perfectly fine.
EDIT:
On further investigation I've found out that the Accept Header of the request isn't accepted by my webservice. Can I add it somewhere?
So my Question transforms to: How can I override the MvxFileDownloadRequest class to add an accept header?
How can I override the MvxFileDownloadRequest class to add an accept header?
The only way to do this is to implement your own IMvxHttpFileDownloader implementation and to register it with IoC in place of the default one.
The source for the default one is https://github.com/MvvmCross/MvvmCross/blob/v3.1/Plugins/Cirrious/DownloadCache/Cirrious.MvvmCross.Plugins.DownloadCache/MvxHttpFileDownloader.cs and this question was similar - MvvmCross HTTP DownloadCache with authentication - if this is a common request, then happy to see this pushed back into MvvmCross core.
Is there a way in Rails to escape code inserted in a textarea? If I post rails code at this point, there are some symbols that conflict with html (<< for instance) that don't render. Any thoughts on how to avoid this? In fact in some things I test, I make a post and it doesn't show up at all when I try to render it. I assume this is because of some conflict with the code I am posting.
You can possibly call a javascript function on window.onload/$(document).ready, that will remmove the html specific special character
So I'm attempting to use the custom subscriber SDK for Growl for Windows. Trying to dynamically create a RSS feed. Using C#, with Razor views. This is a sample of what the view looks like to which I am pointing the url of the subscriber:
#model GrowlExtras.Subscriptions.FeedMonitor.FeedItem
<?xml version="1.0" encoding="UTF-8" ?>
#{
Response.ContentType = "application/rss+xml";
ViewBag.Title = "Feed";
}
<rss version="2.0">
<channel>
<title>#Model.Title</title>
<link>#Url.Action("Feed", "Home", null, "http")</link>
<description>#Model.Description</description>
<lastBuildDate>#Model.PubDate</lastBuildDate>
<language>en-us</language>
</channel>
</rss>
This page is accessed locally (for now) using this url: http://localhost:2751/Home/Feed. So, I'm putting this url in as the "Feed Url:" on the "subscribe to notifications popup".. but getting an error "could not parse feed" and the OpenReadCompletedEventArgs e result is throwing the exception "OpenReadCompletedEventArgs '(e.Result).Length' threw an exception of type 'System.NotSupportedException'"
Any help welcome! Am I barking up the wrong tree completely here, or just missing something with the formatting of the feed file? Don't suppose it has something to do with the fact that the page is hosted locally at the moment?
The real answer is that Razor verifies that what you are trying to write is valid HTML. If you fail to do so, Razor fails.
Your code tried to write incorrect HTML:
If you look at the documentation of link tag in w3schools you can read the same thing expressed in different ways:
"The element is an empty element, it contains attributes only."
"In HTML the tag has no end tag."
What this mean is that link is a singleton tag, so you must write this tag as a self-closing tag, like this:
<link atrib1='value1' attrib2='value2' />
So you can't do what you was trying to do: use an opening and a closing tag with contents inside.
That's why Razor fails to generate this your <xml> doc.
But there is one way you can deceive Razor: don't let it know that you're writing a tag, like so:
#Html.Raw("<link>")--your link's content--#Html.Raw("</link>")
Remember that Razor is for writing HTML so writing XML with it can become somewhat tricky.
Right. Got this one sorted now.
A lot more digging was required! The page above did not parse correctly as a valid xml page, for example - html tags are being generated here, and this throws the rss parser of the plugin in question.
What I ended up doing was to use the built in RSS Syndication classes, and some help from these posts/related answers on the topic.
<http://stackoverflow.com/a/825016/1152015>
<http://stackoverflow.com/a/684518/1152015>
<http://stackoverflow.com/a/1292769/1152015>
<http://stackoverflow.com/a/2690302/1152015>
<http://stackoverflow.com/a/3098559/1152015>
<http://msdn.microsoft.com/en-us/library/bb412174>
So, to clarify - I had the code to consume a rss feed, but the page being generated dynamically was not being parsed correctly by the parser I was using.
the site addres: http://www.ynet.co.il/YediothPortal/Ext/TalkBack/CdaTalkBack/1,2497,L-3650194-0-68-544-0--,00.html
fill the form with rubbish.
Hit 'Send'
the form post the data to another HTML without any parsing of the data i've just added
How do they do it?
A likely option is that they are using a content management system where "html" on the URL doesn't actually mean it's a static html file.
This may be out of left field, but I've certainly used the occasional JS function to grab everything in the header and either parse it or pass it to another script using AJAX.
I'll sometimes use this method in a 404.html page to grab the headers of the previous page, parse them out to see where someone was trying to go and redirect them.
That is, as annakata said, one of the numerous options available.
Edit based on clarified question:
Numerous frameworks can be configured to intercept an html request - for instance asp.net can be set to handle any given extension and an HTTPModule could do anything with that. It's really up to web server configuration what it decides to do with any request.
also: you don't really want to be saying "hijack"