Contact Form email charset

This is a place to discuss how to adapt mojoPortal to the needs of different cultures. Before asking questions here please first review the localization documentation.

This thread is closed to new posts. You must sign in to post in the forums.
3/8/2008 10:34:28 AM
Gravatar
Total Posts 2

Contact Form email charset

I sent russian text by ContactForm and message i recieved is unreadable. It seems that default charset is "iso-8859-1" and there is no way to change it without rebuilding sources. Is it true?

3/8/2008 10:43:19 AM
Gravatar
Total Posts 18439

Re: Contact Form email charset

No, there is no hard coding of charset. I think it could be because we are applying security to prevent cross site scripting in the message.

I would temporarily set this to false in Web.config and see if it changes the result:

UseNeatHtmlForXSSPrevention

Let me know if that fixes it for you or not.

Since it is sending html email my understanding is the html content should be utf-8

Hope it helps,

Joe

3/25/2008 10:48:28 AM
Gravatar
Total Posts 5

Re: Contact Form email charset

Hello!

I have the same problem with russian version of my website.

Setting UseNeatHtmlForXSSPrevention to false did not solve this issue.

More details: I have 2 sites:

1. main site in english (charset: utf-8)
www.mysite.ru

2. secondary site in russian (charset: windows-1251 - managed in Administration - Site Settings - meta - Default page encoding)
www.mysite.ru/russian

If text in email form on russian site contains any russian symbol  (in subj or body), I will receive email where russian symbols replaced with ?????? (questions).

Also I noted folowing: If body of the message contains any Formatting (bold, italic) - it will preserve!
i.e. I reseive email with bold or italic questions ????? :)

Help please, Joe!
I got 4 messages from my russian users already, but I do not think that they got so many quesions for me )))

 

 

3/25/2008 11:00:52 AM
Gravatar
Total Posts 2

Re: Contact Form email charset

It didn't help. btw, Joe, I've got both notification emails for posts in this thread only today, and they arrived at the same time, but as i see your message was written 8 march.

3/25/2008 11:03:16 AM
Gravatar
Total Posts 18439

Re: Contact Form email charset

Hi,

I don't have an immediate solution for you so my recommendation for handing the immediate problem is take down the contact form and put an html content module with your contact email address like myusername [at] myemaildomain dot com or something similar.

I really don't know the solution about the character encoding, but what I plan to do is implement db storage of the messages posted in the contact form so that messages are not lost even if smtp is not configured. There will be a page for reviewing the posted messages so that even if sending email fails you can still login to the site and read the messages.

I will try to implement this and release it within a week. Then we can still try and figure out the character encoding issue but viewing the messages from the db should work just like any other content in the site.

Hope it helps,

Joe

3/28/2008 3:29:26 PM
Gravatar
Total Posts 5

Re: Contact Form email charset

btw, Joe!

Setting UseNeatHtmlForXSSPrevention = false caused a very annoying thing:

While this option remains false I can't change content in HTML module on my pages!
When I click "Edit" link, editor opens and after making (or not making) some changes, I push UPDATE button and get following error:

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
mojoPortal.Business.WebHelpers.IndexBuilderConfiguration.GetConfig() +191
mojoPortal.Business.WebHelpers.IndexBuilderManager.Initialize() +22
mojoPortal.Business.WebHelpers.IndexBuilderManager..cctor() +64

[TypeInitializationException: The type initializer for 'mojoPortal.Business.WebHelpers.IndexBuilderManager' threw an exception.]
mojoPortal.Business.WebHelpers.IndexBuilderManager.get_Providers() +0
mojoPortal.Web.ContentUI.EditHtml.btnUpdate_Click(Object sender, EventArgs e) +217
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

Then UseNeatHtmlForXSSPrevention = true everything works fine.

Is it a bug or normal for this option?

 

3/31/2008 6:38:14 AM
Gravatar
Total Posts 18439

Re: Contact Form email charset

Hi,

I've completed the implementation for persisting contact form messages in the db. Its in svn trunk now and I will package a new release in the next few days.

I've also looked into the email encoding issues and believe I have found the solution in this article. I'm about to implement and test that solution now. If all goes well that fix will be in svn trunk by tonight.

Best,

Joe

4/2/2008 6:35:40 AM
Gravatar
Total Posts 18439

Re: Contact Form email charset

I've added an option in Web.config that can help with this.

<!-- leave this blank for ascii encoding -->
<add key="SmtpPreferredEncoding" value="" />
<!-- example for Russian encoding
<add key="SmtpPreferredEncoding" value="koi8-r" />
-->

Its in svn trunk now and I'll be packaging a new release later today or tomorrow at the latest.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.