Some weird symbols get displayed : "" on kendo editor control - asp.net-mvc

Some weird symbols get displayed : "", in the kendo editor control, On selecting "insert ordered list" button(in kendo editor toolbar).
This issue occurs only when we change cdn reference(http://kendo.cdn.telerik.com/2014.2.716/js/kendo.all.min.js) to a local file reference(~/Scripts/kendo/2014.2.716/kendo.all.min.js)
, which contains the same data.
This is working ->
<script charset="UTF-8" src="http://kendo.cdn.telerik.com/2014.2.716/js/kendo.all.min.js"></script>
But this is not working ->
<script charset="UTF-8" src="~/Scripts/kendo/2014.2.716/kendo.all.min.js" ></script>
After going through this link: http://www.telerik.com/forums/editor-adding-characters-iuml-raquo-iquest- .
I made few changes but, it didn't fix the issue.
Changes :
1. Changed encoding type of the local file to UTF-8
2. Specified charset for local file
<script charset="UTF-8" src="~/Scripts/kendo/2014.2.716/kendo.all.min.js" ></script>
Added meta tag
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Since the data in the local file is same as the CDN reference. I am suspecting the response headers. You can find it below.
Please let me know if you have any suggestions to fix this issue.
My Server Environment is:-
ASP.net MVC, C#, IIS 8.0 express
Response headers for kendo CDN js file:-
Access-Control-Allow-Origin:*
Age:2090036
Cache-Control:public
Cache-Control:max-age=315360000
Connection:Keep-Alive
Content-Encoding:gzip
Content-Type:application/x-javascript
Date:Mon, 31 Aug 2015 05:26:00 GMT
Expires:Thu, 31 Dec 2037 23:55:55 GMT
Last-Modified:Wed, 16 Jul 2014 11:39:32 GMT
Proxy-Connection:Keep-Alive
Server:nginx
Transfer-Encoding:chunked
Via:1.1 f918bd73555184c9b61c8f42f80c79d1.cloudfront.net (CloudFront)
X-Amz-Cf-Id:emh9zGudv4PxjIHbO0ZEbGIGJoTIGViqcncMZ6ciuUD1geap_pIdfg==
X-Cache:Hit from cloudfront
Response headers for local js file:-
Accept-Ranges:bytes
Access-Control-Allow-Headers:Content-Type
Access-Control-Allow-Methods:POST, GET, OPTIONS
Access-Control-Allow-Origin:*
Content-Length:1731401
Content-Type:application/javascript
Date:Thu, 24 Sep 2015 10:01:29 GMT
ETag:"fbc07be8aaf6d01:0"
Last-Modified:Thu, 24 Sep 2015 09:25:09 GMT
Server:Microsoft-IIS/8.0
X-Powered-By:ASP.NET

Related

Content-Transfer-Encoding: quoted-printable is breaks the break lines

I´m sending emails through a Rails web app using AmazonSes service. I´m sending different types of emails and everything is working fine, but in the next scenario:
The user can write a text like a message with line breaks in a textarea field within a form. This message is stored in our MySQL dababase and sent by email to another user. I have problems with the line breaks, because depending on if I open the email in Gmail webmail or Mac Mail, the break lines are respected or not. I have read a lot of post with similar problem and tried but unfortunately I couldn´t fix it.
As mentioned, I´m using Rails Mailer to send the emails through AmazonSES services.
Input textarea with message:
This is what I store from the textarea field in database: "messagePreOffer"=>"This is paragraph 2.\n\nThis is paragraph 2.\n\nThis is paragraph 3."
Before rendering the mail template the messagePreOffer log shows:
offer.message_pre_offer=This is paragraph 1.
This is paragraph 2.
This is paragraph 3.
Simplified mail template layout:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- NAME: 1:2 COLUMN -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<p><%= #offer.message_pre_offer %></p>
</body>
</html>
We send the email with mailer (I think this is not relevant):
mail(from: APP_CONFIG['EMAIL_FROM'], to: offer.email, bcc: APP_CONFIG['EMAIL_FROM'], subject: t('new_offer_user_subject', departure: #offer.enquire.departure))
Mailer delivery configuration:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "email-smtp.eu-west-1.amazonaws.com",
:port => 587,
...
:authentication => :login,
:enable_starttls_auto => true
}
TEST 1:
This is the log that I got after running and sending the email:
Rendering email_service/send_new_offer_user_notification.html.erb within layouts/email_service
Rendered email_service/send_new_offer_user_notification.html.erb within layouts/email_service (2.0ms)
EmailService#send_new_offer_user_notification: processed outbound mail in 75.5ms
Sent mail to *****#gmail.com (1117.1ms)
Date: Wed, 16 Dec 2020 17:56:23 +0100
From: *******
To: *****#gmail.com
Message-ID: <5fda3c373232d_42433fc7916a717c9102b#MacBook-Pro-****.local.mail>
Subject: Whatever
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_5fda3c3731200_42433fc7916a717c909a4";
charset=UTF-8
Content-Transfer-Encoding: 7bit
----==_mimepart_5fda3c3731200_42433fc7916a717c909a4
Content-Type: text/plain;
**charset=UTF-8
Content-Transfer-Encoding: 7bit**
This is paragraph 1.
This is paragraph 2.
This is paragraph 3.
----==_mimepart_5fda3c3731200_42433fc7916a717c909a4
Content-Type: text/html;
**charset=UTF-8
Content-Transfer-Encoding: 7bit**
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- NAME: 1:2 COLUMN -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<p>This is paragraph 1.
This is paragraph 2.
This is paragraph 3.</p>
</body>
</html>
----==_mimepart_5fda3c3731200_42433fc7916a717c909a4--
With this initial configuration, I get the next results:
Result 1: Same result in Gmail and Mac Mail.
I understand this is right, because I didn´t add any format.
TEST 2:
While making tests to write this post I went one step further. My second test just added the next css, to keep line breaks:
<p style="white-space: pre-line;"><%= #offer.message_pre_offer %></p>
After running the test, I got very surprises that it worked perfectly in both Gmail webmail and Mac mail. Find screen here:
TEST 3:
The lines used in the previous test where just for testing purposes. As the tests worked, I tried to use the real text template in spanish. Surprisingly the test didn´t work.
This is the variable log:
"messagePreOffer"=>"Este es el párrafo 1.\n\nEste es el párrafo 2.\n\nEste es el párrafo 3."
This is the log that I got after running and sending the email:
Sent mail to ***#gmail.com (1130.8ms)
Date: Wed, 16 Dec 2020 18:53:23 +0100
From: *****
To: *****
Message-ID: <5fda499338a0f_42433fc7916a717c946d1#MacBook-Pro-de-******.local.mail>
Subject: Whatever
Mime-Version: 1.0
Content-Type: multipart/alternative;
boundary="--==_mimepart_5fda49933789a_42433fc7916a717c945df";
charset=UTF-8
Content-Transfer-Encoding: 7bit
----==_mimepart_5fda49933789a_42433fc7916a717c945df
Content-Type: text/plain;
charset=UTF-8
**Content-Transfer-Encoding: quoted-printable**
Este es el p=C3=A1rrafo 1.=0D
=0D
Este es el p=C3=A1rrafo 2.=0D
=0D
Este es el p=C3=A1rrafo 3.=
----==_mimepart_5fda49933789a_42433fc7916a717c945df
Content-Type: text/html;
charset=UTF-8
**Content-Transfer-Encoding: quoted-printable**
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.o=
rg/TR/xhtml1/DTD/xhtml1-strict.dtd">=0D
<html xmlns=3D"http://www.w3.org/1999/xhtml" xmlns=3D"http://www.w3.org/1=
999/xhtml">=0D
<head>=0D
<!-- NAME: 1:2 COLUMN -->=0D
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF-8" =
/>=0D
<meta name=3D"viewport" content=3D"width=3Ddevice-width, initial-scale=3D=
1.0" />=0D
</head>=0D
<body>=0D
<p style=3D"white-space: pre-line;">Este es el p=C3=A1rrafo 1.=0D
=0D
Este es el p=C3=A1rrafo 2.=0D
=0D
Este es el p=C3=A1rrafo 3.</p>=0D
</body>=0D
</html>=0D
----==_mimepart_5fda49933789a_42433fc7916a717c945df--
Then in Mail Mac the format is still ok:
However, in Gmail webmail the break lines are broken, with many lines and much more space:
After some tests with the content text, I have found out that the problem starts with the accents. If you take a deep look into the logs, in the first test the charset is:
charset=UTF-8
Content-Transfer-Encoding: 7bit
However, as soon as I include an accent in my text, the content transfer encoding automatically changes to:
charset=UTF-8
**Content-Transfer-Encoding: quoted-printable**
This is the root cause why the break lines are broken. Actually, If I just remove the accent, everything works in Gmail again:
Now, I found the root cause of the problem, but I´m stuck figuring out which is the right solution.
After much more investigation I found this other interesting post: Why isn't Gmail using quoted-printable encoding?
that pointed me that Gmail is not working with quoted-printable. So, I have fixed the problem by forcing the mailer to use 7-bit transfer enconding, with next line in my mailer:
default 'Content-Transfer-Encoding' => '7bit'
I was facing the same issue even with default content_transfer_encoding: 7bit
Rails was still encoding my mail with quoted-printable when ever replying email with large html message.
After spending a day, found this solution working:
mail(
to: ...,
subject: ...,
content_type: 'text/html',
) do |format|
format.html(content_transfer_encoding: 'base64') { Base64.encode64(#mail_box.message) }
end
#mail_box.message is the html contents supplied from a rich text editor. Hope this helps someone.

How to display degrees symbol without encoding?

How can I get the degrees symbol to display correctly on a web page created with Asp.Net MVC without encoding it? The following HTML code will display �C using VS 2017:
<!doctype html>
<html>
<head>
<title>Test</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
</head>
<body>
<div>°C</div>
</body>
</html>
The problem was solved by ensuring that the source file in Visual Studio 2017 was saved with the correct UTF-8 encoding.
To do this, first select Save As from the File menu. Then select the "Save with Encoding..." option in the Save dialog:
Then select the UTF-8 encoding:

WebHarvest can't find response headers

I'm working with WebHarvest to fetch data from a site that requires logging in.
It's setup like this:
Page 1 = Login page
Page 2 = Login validation page
Page 3 = Statistics page
On page 2 a cookie is set. When monitoring the opening of Page 2 with Firebug I get these headers:
Connection Keep-Alive
Content-Type text/html; charset=UTF-8
Date Tue, 23 Oct 2012 18:25:12 GMT
Keep-Alive timeout=15, max=100
Server Apache/2.0.64 (Win32) JRun/4.0 SVN/1.3.2 DAV/2
Set-Cookie SESSION=hej123;expires=Thu, 16-Oct-2042 18:25:12 GMT;path=/
Transfer-Encoding chunked
When calling the same page with WebHarvest I only get these headers:
Date=Tue, 23 Oct 2012 18:31:51 GMT
Server=Apache/2.0.64 (Win32) JRun/4.0 SVN/1.3.2 DAV/2
Transfer-Encoding=chunked
Content-Type=text/html; charset=UTF-8
It seems that three headers (Set-Cookie, Connection and Keep-Alive) are not found by WebHarvest. Page 1, 2 and 3 are dummys so no actual validation is done. The cookie is always set on the serverside for Page 2.
Here is the WebHarvest code I am currently using:
<var-def name="content2">
<html-to-xml>
<http method="post" url="http://myurl.com/page2.cfm">
<http-param name="Login">sigge</http-param>
<http-param name="Password">hej123</http-param>
<http-param name="doLogin">Logga in</http-param>
<loop item="currField">
<list>
<var name="ctxtNewInputs" />
</list>
<body>
<script><![CDATA[
item = (NvPair) currField.getWrappedObject();
SetContextVar("itemName", item.name);
SetContextVar("itemValue", item.value);
]]></script>
<http-param name="${item.name}"><var name="itemValue" /></http-param>
</body>
</loop>
<script><![CDATA[
String keys="";
for(int i=0;i<http.headers.length;i++) {
keys+=(http.headers[i].key + "=" + http.headers[i].value +"\n---\n");
}
SetContextVar("myCookie", keys);
]]></script>
<file action="write" path="c:/kaka.txt">
<var name="myCookie"/>
</file>
</http>
</html-to-xml>
</var-def>
Edit:
when checking I noticed that the cookie is set in WebHarvest, even if the http header can't be found programatically. Is it possible that some response headers are hidden from usage?
Does anyone know a work-around for this problem?
Thank you and best regards,
SiggeLund
The way to get http header value into user-defined variable scoped for the whole config is the following:
<http url="your.url.here" method="GET">
<!--Any settings you apply for the POST/GET call-->
</http>
<!--Now you've got your http object you are going to get header value from -->
<!--At it simplest the acquisition of value goes like the below-->
<var-def name="fifth_header_val">
<script return="http.headers[5].value"/>
</var-def>
The above is just to give a clue. You can iterate over http.headers index and collect keys and values you need for your particular task.

Why does this webpage display differently when URL forwarded?

I have a simple Google maps web application I'm working on. I have purchased a domain name for the application (http://www.jcunav.com), which during my testing, is designed to simply forward to a page which is hosted on my another domain name of mine (http://www.codeemporium.com/experiments/map5.html). Testing on my Android Nexus S, I am noticing strange behaviour however - if I visit http://www.codeemporium.com/experiments/map5.html directly, then the app displays as intended - the map is the size I want and clicking the "About" link brings up a dialog the size I want. If I visit http://www.jcunav.com however (which, keep in mind, simply forwards to http://www.codeemporium.com/experiments/map5.html), the map displays at what looks like a more zoomed out level, and pressing the "About" link at the bottom of the page shows a dialog box which also appears more zoomed out. My question is, what could be causing this to occur, given that all http://www.jcunav.com is doing is forwarding to http://www.codeemporium.com/experiments/map5.html...
Are you certain you aren't frame-forwarding? I examined the page in firebug for each of the links you provided and it appears to me that you are frame-forwarding the URL. This results in your target page being 'wrapped' in a frame when presented to the end user. Odds are high that this is why it is not working for you.
Here is a somewhat lossy version of what is in the forwarded page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>JCU Nav</title>
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</head>
<frameset frameborder="0" framespacing="0" border="0" rows="100%,*">
<frame name="MYTOPFRAME" src="http://www.codeemporium.com/experiments/map5.html" noresize>
-- snip --
</frameset>
</html>
Notice the frame tag:
<frameset frameborder="0" framespacing="0" border="0" rows="100%,*">
<frame name="MYTOPFRAME" src="http://www.codeemporium.com/experiments/map5.html" noresize>
This is what happens when you frame forward.
Since your sizing relies on additions to the HTML tag:
<html class="ui-mobile landscape min-width-320px min-width-480px min-width-768px min-width-1024px">
They do not work in the frame-forwarded version because they are nested inside the frame and not on the root page.
That's because http://www.jcunav.com is not forwarding to http://www.codeemporium.com/experiments/map5.html, it is loading it into a frame:
C:\Documents and Settings\blah>wget -S -O - http://www.jcunav.com/
--01:05:21-- http://www.jcunav.com/
=> `-'
Resolving www.jcunav.com... 66.150.161.141, 69.25.27.173, 63.251.171.80, ...
Connecting to www.jcunav.com|66.150.161.141|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Sun, 01 May 2011 05:01:11 GMT
Server: Apache/2.0.49 (Unix) PHP/4.3.9
X-Powered-By: PHP/4.3.9
Content-Length: 823
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Length: 823 [text/html]
0% [ ] 0 --.--K/s <
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>JCU Nav</title>
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</head>
<frameset frameborder="0" framespacing="0" border="0" rows="100%,*">
<frame name="MYTOPFRAME" src="http://www.codeemporium.com/experiments/map5.html" noresize>
<noframes>
<body>
<h1>JCU Nav</h1>
<br>
<br>
<br>
Click here to enter <a href="http://www.codeemporium.com/experiments/map5.html">http://www.codeemporium.com/e
xperiments/map5.html</a>
<hr>
| Domain Name Registration and Domain Name Forwarding by <a href="http://www.mydomain.com">mydomain.com - Register your
domain name</a>
</body>
</noframes>
</frameset>
</html>
You'll need to actually change that frame set to do the right thing.

With Rails, How can I expire the Browser's cache?

I have an issue with my Rails application and the browser's cache: When a user logs out of the authenticated section of the site, they are still able to use the back button on the browser to see the authenticated page. I do not want to allow this.
How can I expire the cache and force it to reload.
Thank you
The following headers should do that. Whatever page you're trying protect, add them there.
Expires: Sat, 26 Jul 1997 05:00:00 GMT
Last-Modified: "now"
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Obviously, the now needs to be dynamic.
Just to be safe, you might also want to specify
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
in your pages.

Resources