[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Notice: in file [ROOT]/includes/session.php on line 2208: Array to string conversion
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Poco Forums • View topic - How can I change the charset of script-generated message?

How can I change the charset of script-generated message?

Scripting questions and ideas

Moderators: Eric, Tomas, robin, Michael

How can I change the charset of script-generated message?

Postby Shady_Shen » Wed Nov 22, 2006 4:58 pm

I am working on an auto-reply script but every new message the script creates comes along with a default charset of "iso-XXXX" (which doesn't support Chinese characters) and I simply couldn't figure out how I can change the charset of my newly created message to "GB2312".


Anyone can help me with this? 3x
Shady_Shen
New Arrival
 
Posts: 3
Joined: Wed Nov 22, 2006 2:57 pm

Postby Tomas » Thu Nov 23, 2006 12:07 am

Untested, but did you try something like this:

Code: Select all
DeleteHeader "Content-Type:" %message
AddHeader %message "Content-Type:" "text/plain; charset="GB2312""



Alternatively, not best solution for your problem, but you can setup an outgoing filter, with an action to change CharSet to GB2312.
Tomas
Pillar of the Community
 
Posts: 1418
Joined: Sun Jul 25, 2004 1:34 am

Postby Shady_Shen » Thu Nov 23, 2006 12:59 am

Yes, I tried this. And in the following form actually:

DeleteHeader "Content-Type:" %m
AddHeader %m "Content-Type:" "text/plain; charset=\"GB2312\""

(escaping the quotation mark)



And for debug purposes I "messagebox" the header of the message and get what I want

Content-Type: text/plain; charset="GB2312"


But unfortunately, it seems that when I savemessage %m "out.mbx",Pocomail will replace the header of this message with something like this:
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


thus making all my efforts futile. :(


So.... anyone knows what to do next? Have I made any mistake with "savemessage"? maybe I can send the message another way around? how?
Shady_Shen
New Arrival
 
Posts: 3
Joined: Wed Nov 22, 2006 2:57 pm

Postby Tomas » Thu Nov 23, 2006 1:43 am

I just, though somewhat vaguely, remembered, longer time ago, it was probably purposefully impossible to change this header inside Pocomail, and that's why the Change CharSet filter action was added.

I would recommend you to create any kind of customer header through your script, eg X-VacationReply:, or whatever, and create a filter for outgoing messages on that header, with an action to change Charset. So that your regular messages are safe, and only those with custom header are treated with the charset change.

Though, hopefully someone more experienced with Pocoscript will jump in to confirm, or with better suggestion.
Tomas
Pillar of the Community
 
Posts: 1418
Joined: Sun Jul 25, 2004 1:34 am

Postby Shady_Shen » Thu Nov 23, 2006 1:59 am

Handy tools really have their own idiosyncracies, don't they?

Anyway, your solution works!

Thanks a lot , Tomas! Really timely help!
Shady_Shen
New Arrival
 
Posts: 3
Joined: Wed Nov 22, 2006 2:57 pm


Return to PocoScript Help and How-To

Who is online

Users browsing this forum: No registered users and 2 guests

cron