WebAccess 6.30.x Unicode Support in emails

If you made patches for any part of Zarafa, post them here.

WebAccess 6.30.x Unicode Support in emails

Postby holloway on 2009-11-25, 23:29

This patch add Unicode support to HTML text areas. Replace client/layout/js/dialog.js with this file or alternatively patch that file with these two alterations.

Add this to the top of the file,
Code: Select all
function unicode_to_entity(text){
   var ncr_text = ""
   var text_length = text.length
   for(var index = 0; index < text_length; index++) {
      var character = text.charAt(index)
      var ncr_character = character.charCodeAt(0)
      if(ncr_character < 128) {
         ncr_text += character
      }
      else {
         ncr_text += "&#"+ncr_character+";"
      }
   }
   return ncr_text
}


And then find the line that reads
Code: Select all
props["body"] = cleanHTML(fckEditor.GetXHTML());


And replace it with,
Code: Select all
props["body"] = unicode_to_entity(cleanHTML(fckEditor.GetXHTML()));


PLEASE NOTE: After installing the patch be sure to clear all of your browser cache because the patch modifies JavaScript that your browser would typically cache.

Just to be clear on what this fixes and what it doesn’t:
  • It's based on serializing Unicode characters as Numerical Character References to get Unicode support. It’s not Unicode as UTF-8 support, however any UTF-8 characters are converted to NCRs when writing emails and the difference between UTF-8 and NCRs are transparent to the user.
  • It adds Unicode support to the body of the email in the web client (but not subject lines, or calendar events). Basically any plain-text input won’t support it but any rich-text area should.
  • Athough the patch infact adds support for all Unicode characters each email client will have different capabilities at understanding NCRs. Eg, support for Thai or Sanskrit will be a bit iffy in Microsoft’s Mac Entourage, but most email clients should Just Work[tm]
  • We’ve tested viewing Maori Macrons (used in a language of New Zealand) in the Zarafa web client, Evolution, Thunderbird, Microsoft’s Mac Entourage, and Outlook and they look fine.

For testing here's a ZIP of sample files with various text encodings.

I'm interested in hearing how it works for people and suggestions for improvements. Cheers,
Last edited by holloway on 2009-11-30, 02:41, edited 2 times in total.
holloway
Junior Member
 
Posts: 4
Joined: 2009-11-25, 22:53

Re: WebAccess 6.30.x Unicode Support in emails

Postby manfred on 2009-11-27, 22:11

Hi holloway,

first tests with baltic characters look good :) Thanks for the contribution.

Greets, Manfred
manfred
Senior Member
 
Posts: 169
Joined: 2007-11-22, 20:00
Location: Belo Horizonte, Brazil

Re: WebAccess 6.30.x Unicode Support in emails

Postby andres on 2009-12-25, 00:10

thanks this is working great. We are using some special characters to build our signatures in e-mail, but it never worked in webaccess (the characters were replaced with 2 questionmarks) until your patch came along! thank you!


Andres
andres
Junior Member
 
Posts: 18
Joined: 2009-04-20, 11:19

Re: WebAccess 6.30.x Unicode Support in emails

Postby loki87 on 2010-07-03, 01:44

with 6.4 and Outlook 2007, where is the solution ? i have a lot of wrong chrakters here with Outlook 2007 and Zarafa Standard
Ubuntu 10.4 Server x64
MySQL 5.1.41
Zarafa Version: 6.40.0-20653-lucid~1
Clients Outlook 2007 with MAPI
loki87
Junior Member
 
Posts: 5
Joined: 2010-06-07, 15:42