Danish characters in text emails [solved]

General talk about translations & I18n (Internationalization)

Danish characters in text emails [solved]

Postby Guest » 11:43am, Wed 19 Nov, 2008

I have been looking around this forum to solve my problem but I can't find anything that works.

æ ø å is shown as strange characters i text emails. Not in html emails, only in text emails.

I my config.php I have tis: $language_module = "danish.inc";

Så why doesn't it work?


Regards
Jeppe D.
Guest
 

Postby Guest » 1:23pm, Wed 19 Nov, 2008

I solved it poutting this code into the add_text function in class.phplistmailer.php

// danske
$text = str_replace("æ", "æ", $text);
$text = str_replace("ø", "ø", $text);
$text = str_replace("Ã¥", "å", $text);
$text = str_replace("Æ", "Æ", $text);
$text = str_replace("Ø", "Ø", $text);
$text = str_replace("Ã…", "Å", $text);

You are welcome to expand it with your own characters.
Guest
 

Re: Danish characters in text emails [solved]

Postby michael2820 » 10:09pm, Sat 25 Dec, 2010

Vi kan vel lige så godt skrive dansk her, eller hvad? Jeg har rodet med dette program hele dagen og har rettet og testet som en gal. Det ser skidegodt ud programmet. Kan du ikke kopiere linier før og efter så jeg kan se præcis, hvor du sat koden ind. Tak.
Michael
michael2820
phpLister
 
Posts: 5
Joined: 10:06pm, Sat 25 Dec, 2010

Re: Danish characters in text emails [solved]

Postby dykkeren » 2:40pm, Sat 19 Feb, 2011

Hey,

Jeg satte den ind på linie 33, så den kom til at sådan ud:

Code: Select all
<?php
require_once dirname(__FILE__).'/accesscheck.php';

## update to phpmailer v2 is not finished yet
# require( dirname(__FILE__) . '/phpmailer2/class.phpmailer.php');

require( dirname(__FILE__) . '/phpmailer/class.phpmailer.php');

class PHPlistMailer extends PHPMailer {
    var $isText = false;
    var $WordWrap = 75;
    var $encoding = 'base64';
    var $image_types = array(
                  'gif'  => 'image/gif',
                  'jpg'  => 'image/jpeg',
                  'jpeg'  => 'image/jpeg',
                  'jpe'  => 'image/jpeg',
                  'bmp'  => 'image/bmp',
                  'png'  => 'image/png',
                  'tif'  => 'image/tiff',
                  'tiff'  => 'image/tiff',
                  'swf'  => 'application/x-shockwave-flash'
                  );

    function PHPlistMailer($messageid,$email) {
    #  parent::PHPMailer();
      parent::SetLanguage('en', dirname(__FILE__) . '/phpmailer/language/');
      $this->addCustomHeader("X-Mailer: phplist v".VERSION);
      $this->addCustomHeader("X-MessageID: $messageid");
      $this->addCustomHeader("X-ListMember: $email");
      $this->addCustomHeader("Precedence: bulk");
      $this->CharSet = getConfig("html_charset");
        // danske
   $text = str_replace("æ", "æ", $text);
   $text = str_replace("ø", "ø", $text);
   $text = str_replace("Ã¥", "å", $text);
   $text = str_replace("Æ", "Æ", $text);
   $text = str_replace("Ø", "Ø", $text);
   $text = str_replace("Ã…", "Å", $text);
dykkeren
phpList newbie
 
Posts: 2
Joined: 2:34pm, Sat 19 Feb, 2011

Re: Danish characters in text emails [solved]

Postby Kruge » 8:57am, Tue 30 Aug, 2011

Bloody Hellfire!

This looks a LOT like something that could help me with my Problem I have with German Umlaute too (ÄöÜ)...

I will give it a try right away - if this works I suggest adding this "trick" to some FAQs that deal with internationalisation. :)
Kruge
PL Nut
 
Posts: 22
Joined: 2:15pm, Wed 01 Jun, 2011

Re: Danish characters in text emails [solved]

Postby Kruge » 1:18pm, Tue 30 Aug, 2011

Yes, it actually worked!

Although my problem was specifically Umlaute in the message's Subject, so I needed some additional stuff and put it in another place (sendemaillib.php) - but it was your concept, that finally gave me the idea how:

At Line 759 we find:
Code: Select all
  if (!TEST) {
    if ($hash != 'forwarded' || !sizeof($forwardedby)) {
      $fromname = $cached[$messageid]["fromname"];
      $fromemail = $cached[$messageid]["fromemail"];
      $subject = $cached[$messageid]["subject"];


and to that I added:

Code: Select all
     $subject = str_replace("&auml;", "ä", $subject);
     $subject = str_replace("&szlig;", "ß", $subject); // and analogue the other Umlaute - or in your case Danish Letters
     $subject = preg_replace('~([\xA0-\xFF])~e', '"=" . strtoupper(dechex(ord("$1")))', $subject); // these two lines do the actual trick
     $subject = '=?ISO-8859-1?Q?' . $subject . '?=';


The first added line(s) are a workaround I use so I can WRITE Subjects with Umlaute in them in phplist - because the Database on my server isn't set up correctly it won't do so if I, for example, enter a subject like: "Übersetzungen" phplist will save nothing, apparently - when I refresh the field shows up empty again. I have neither the rights nor the knowledge to deal with the Database side of the problem, so I solved it without even touching the Database:

Instead of "Übersetzungen" now I can simply write "&Uuml;bersetzungen" in phplist. Then in the mailer that - database compatible - notation gets changed to the actual Umlaut and THEN (and here comes the clever part I found in another forum dealing with the same basic problem - we're not alone with this in phplist ^^) the next two lines actually encode them to be displayed correctly in a Mail Subject line.
Kruge
PL Nut
 
Posts: 22
Joined: 2:15pm, Wed 01 Jun, 2011

Re: Danish characters in text emails [solved]

Postby margeir » 1:57pm, Mon 21 Nov, 2011

What I have done,
to get the Icelandic working is this.


$subject = iconv("ISO-8859-1","UTF-8", $subject);

Working on the same spot you guys where.
Line 763 in admin/sendmaillib.php
margeir
phpList newbie
 
Posts: 1
Joined: 1:53pm, Mon 21 Nov, 2011

Re: Danish characters in text emails [solved]

Postby Kruge » 2:11pm, Mon 21 Nov, 2011

margeir wrote:What I have done,
to get the Icelandic working is this.

$subject = iconv("ISO-8859-1","UTF-8", $subject);

Working on the same spot you guys where.
Line 763 in admin/sendmaillib.php


I'm still rather green with the whole php thing, but this sounds better than what I did! Nice. :)
Kruge
PL Nut
 
Posts: 22
Joined: 2:15pm, Wed 01 Jun, 2011

Re: Danish characters in text emails [solved]

Postby ovewilmann » 12:53pm, Tue 22 May, 2012

margeir wrote:What I have done,
to get the Icelandic working is this.


$subject = iconv("ISO-8859-1","UTF-8", $subject);

Working on the same spot you guys where.
Line 763 in admin/sendmaillib.php

I added this to both IF and ELSE statements just after $subject was set, and it WORKED :D

Thanks to Margeir for this fix.

I hope this can be implemented in the upcoming version, so that is works for Scandinavia languages
ovewilmann
phpList newbie
 
Posts: 1
Joined: 12:46pm, Tue 22 May, 2012

Re: Danish characters in text emails [solved]

Postby RAYNAU » 3:01am, Mon 20 Aug, 2012

Yes it works correctly in the subject and I have tested and tried it. No problem.
But the point is : how to use your system for the message by itself. In text mode, some characters, even standard characters are not correctly transfered. I shall take an exemple it's the ' is not correctly converted etc..

You have given the solution for the subject, can you give it for the message ?

Thanks.
RAYNAU
PL Master
 
Posts: 261
Joined: 4:32pm, Tue 03 Jan, 2012


Return to Translators & Internationalization

Who is online

Users browsing this forum: No registered users and 1 guest