Page Index Toggle Pages: 1 [2] 3 
Topic Tools
 25 utf-8 support (Read 21,394 times)
nepzykid
YaBB Newcomer
*
Offline



Posts: 3
Re: utf-8 support
Reply #22 - Oct 25th, 2007 at 5:08am
Post Tools
i am a beginner here.. really dumb here..  Embarrassed i want to type some Chinese in my forum. but when i type it turns out to be, som unreadable characters. well so where to add that patch thing? can you please help me? thank you  Smiley
  

in pursuit of happyness
Back to top
 
IP Logged
 
jasinner
YaBB Newcomer
*
Offline



Posts: 46
Re: utf-8 support
Reply #21 - Jul 28th, 2007 at 9:25pm
Post Tools
Thanks alot MishDan,

It works great. Smiley
« Last Edit: Jul 28th, 2007 at 9:26pm by jasinner »  

Have fun, keep a diary in english&&English日記
Back to top
WWW  
IP Logged
 
MishDan
Full Member
***
Offline



Posts: 228
Location: Kyiv, Ukraine
Re: utf-8 support
Reply #20 - Jul 28th, 2007 at 6:11pm
Post Tools
I now mainly work on the 2.2 CVS Smiley
Edited:
Ahha, see. 2.1 have sub sendmail in Subs.pl, and does not sends Content-type header string.
so.
Subs.pl, sub sendmail:
+      $charsetheader = $yycharset;
         $fromheader = $from ? "$from" : "$mbname <$webmaster_email>";
         $toheader   = $to   ? "$to"   : "$mbname $smtp_txt{'555'} <$webmaster_email>";
         unless ($from) { $from = $webmaster_email; }
...
         # Thanks to Graham J for your contribution to this routine
         if ($mailtype == 1) {
               require "$sourcedir/Smtp.pl";
+            $smtp_charset = $charsetheader;
               &use_smtp;
         }
...
                     $smtp->datasend("X-Mailer: YaBB Net::SMTP\r\n");
                     $smtp->datasend("Subject: $subject\r\n");
+                  $smtp->datasend("Content-Type: text/plain\; charset=$charsetheader\r\n");
                     $smtp->datasend("\r\n");
                     $smtp->datasend($message);
...
               print MAIL "X-Mailer: YaBB Sendmail\n";
               print MAIL "Subject: $subject\n";
+            print MAIL "Content-Type: text/plain\; charset=$charsetheader\n\n";
               $message =~ s/\r\n/\n/g;
               print MAIL "$message\n";
               close(MAIL);

Smpt.pl: 115:
       &send_line ("From: $fromheader\r\n");
         &send_line ("X-Mailer: YaBB SMTP\r\n");
         &send_line ("Subject: $subject\r\n");
+      &send_line ("Content-Type: text/plain\; charset=$smtp_charset\r\n\r\n");
         &send_line ("$message");
         &send_line ("\r\n.\r\n");
« Last Edit: Jul 28th, 2007 at 6:59pm by MishDan »  

P.S. Sorry, my English is not so good, as I wish
Back to top
WWWGTalkICQ  
IP Logged
 
jasinner
YaBB Newcomer
*
Offline



Posts: 46
Re: utf-8 support
Reply #19 - Jul 28th, 2007 at 6:08pm
Post Tools
Which version of YaBB do you use?

I am using YaBB 2.1 Stable release and I don't have Mailer.pl
Undecided
  

Have fun, keep a diary in english&&English日記
Back to top
WWW  
IP Logged
 
MishDan
Full Member
***
Offline



Posts: 228
Location: Kyiv, Ukraine
Re: utf-8 support
Reply #18 - Jul 28th, 2007 at 1:26pm
Post Tools
I currently has not experimented with mails at all, but, AFAICS, Mailer.pl uses $yycharset as $charsetheader, so, AFA client understands utf-8 and $yycharset is set right, there should be no problems... If You experienced some of them - report, and I see, what I can do. Smiley
« Last Edit: Jul 28th, 2007 at 1:29pm by MishDan »  

P.S. Sorry, my English is not so good, as I wish
Back to top
WWWGTalkICQ  
IP Logged
 
jasinner
YaBB Newcomer
*
Offline



Posts: 46
Re: utf-8 support
Reply #17 - Jul 28th, 2007 at 6:43am
Post Tools
How did you handle sending UTF-8 email?

In admin center which email setting?

I could send mail using MIME::Lite module of Perl. Do I have to rewrite a SMTP.pl to use MIME::Lite?

or there is an easier way?
  

Have fun, keep a diary in english&&English日記
Back to top
WWW  
IP Logged
 
MishDan
Full Member
***
Offline



Posts: 228
Location: Kyiv, Ukraine
Re: utf-8 support
Reply #16 - Jul 5th, 2007 at 8:52am
Post Tools
In Your case,
[tt]sub wrap2 {
     $message =~ s~<a href=("?)(\S*)("?)(\starget="_blank")?>([color=magenta]([\x21-\x7F]|[\xC0-\xFF][\x80-\xBF]{1,3})[/color]{$linewrap})(\S*)</a>~<a href=$1$2$3$4>$5\n$[color=magenta]7[/color]</a>~gi;
}[/tt]
should work (although this form wraps very long link only one time - recently there are changes in this code to cut such a long links at all, but currently I have no working version of that new function, that supports utf-8).
« Last Edit: Jul 5th, 2007 at 8:53am by MishDan »  

P.S. Sorry, my English is not so good, as I wish
Back to top
WWWGTalkICQ  
IP Logged
 
jasinner
YaBB Newcomer
*
Offline



Posts: 46
Re: utf-8 support
Reply #15 - Jul 5th, 2007 at 5:10am
Post Tools
I installed your mod and it works well, Thank you!

I got an error on the last step of the mod though. I don't think I have installed any other mods that editted by subs.pl

In my subs.pl couldn't find the line
sub wrap2 {
     $message =~ s~<a href=("?)(\S*)("?)(\starget="_blank")?>(\S{$linewrap})(\S*)</a>~<a href=$1$2$3$4>$5\n$6</a>~gi;
     $message =~ s~<a href=("?)(\S*)("?) target=\"_blank\" onclick=\"(.+?)\">(\S{$linewrap})(\S*)</a>~<a href=$1$2$3 target=\"_blank\" onclick=\"$4\">$5\n$6</a>~g;
}

sub RemoveThreadFiles {


my sub wrap2 was:
sub wrap2 {
     $message =~ s~<a href=("?)(\S*)("?)(\starget="_blank")?>(\S{$linewrap})(\S*)</a>~<a href=$1$2$3$4>$5\n$6</a>~gi;
}

And not followed by sub RemovethreadFiles
« Last Edit: Jul 5th, 2007 at 6:15am by jasinner »  

Have fun, keep a diary in english&&English日記
Back to top
WWW  
IP Logged
 
MishDan
Full Member
***
Offline



Posts: 228
Location: Kyiv, Ukraine
Re: utf-8 support
Reply #14 - Jun 29th, 2007 at 2:01am
Post Tools
:D
On machine, where I today working there are no X installed, so I written a perl script-convertor of diff output into .mod ...

Result is attached. It is somewhat not optimized, but it is bet for convertor simplicity.

P.S. It is not zipped!
I have no zip installed also :D
Just $ mv yabb-2.2-utf_8-3.mod{.zip,}

P.P.S. Heh, and how to create file with mod format?
"edit file" and then? "add after?"

[edit]P.P.P.S. Oops... Renewed attachmen - fixed error in convertor.[/edit]
« Last Edit: Jun 29th, 2007 at 3:21am by MishDan »  

yabb-2_2-utf_8-3_mod_001.zip (Attachment deleted)

P.S. Sorry, my English is not so good, as I wish
Back to top
WWWGTalkICQ  
IP Logged
 
MF-B
Development Team
****
Offline



Posts: 2,405
Location: Moscow, Russia

YaBB 2.4
Re: utf-8 support
Reply #13 - Jun 28th, 2007 at 7:25pm
Post Tools
If be problem - I can help to you... Wink
  

Stand!
Back to top
IP Logged
 
MishDan
Full Member
***
Offline



Posts: 228
Location: Kyiv, Ukraine
Re: utf-8 support
Reply #12 - Jun 28th, 2007 at 7:24pm
Post Tools
Thanks, I try it and convert existing...
  

P.S. Sorry, my English is not so good, as I wish
Back to top
WWWGTalkICQ  
IP Logged
 
MF-B
Development Team
****
Offline



Posts: 2,405
Location: Moscow, Russia

YaBB 2.4
Re: utf-8 support
Reply #11 - Jun 28th, 2007 at 7:17pm
Post Tools
@MishDan

BoardMod, this include ModEditor Wink
  

Stand!
Back to top
IP Logged
 
MishDan
Full Member
***
Offline



Posts: 228
Location: Kyiv, Ukraine
Re: utf-8 support
Reply #10 - Jun 28th, 2007 at 7:02pm
Post Tools
2 MF-B:
Ehh, well, and which tools to use to generate it?.. Smiley

2 Corey Chapman:
This will be great, but, IMHO, it also will be great work.
These patches are hacks "to only get it work without <?>'s". It is much better idea to make that by perl's own facilities eg 'use utf-8'. Then all those  strange \xXX regexes will disappear and length($something_utf_8) will return proper length.
But currently I have no perl knowledge and entire yabb code view to go by that path.
  

P.S. Sorry, my English is not so good, as I wish
Back to top
WWWGTalkICQ  
IP Logged
 
Corey Chapman
YaBB Administrator
*****
Offline



Posts: 10,015
Location: Rock Hill, South Carolina

None
Re: utf-8 support
Reply #9 - Jun 28th, 2007 at 6:33pm
Post Tools
Is this something that can be considered a bug and should be put into effect in the next release?
  

Back to top
IP Logged
 
MF-B
Development Team
****
Offline



Posts: 2,405
Location: Moscow, Russia

YaBB 2.4
Re: utf-8 support
Reply #8 - Jun 28th, 2007 at 6:29pm
Post Tools
@MishDan

Nice... Cheesy Smiley

But in YaBB mods use other format for mods/patches

sample

Code
Select All
<search for>
		&ToChars($member{'name'});
</search for>

<add after>
		&ToHTML($member{'location'});
		&ToHTML($member{'bday'});
		&ToHTML($member{'sesquest'});
</add after>

<search for>
		&ToHTML($FORM{'hideemail'});
</search for>

<replace>
		&ToHTML($member{'hideemail'});
</replace>

<search for>
		# Time to print the changes to the username.vars file
		${$uid.$user}{'usertext'}	= "$member{'usertext'}";
</search for>

<add before>
		&ToHTML($member{'userpic'});
		&ToHTML($member{'usertimeoffset'});
		&ToHTML($member{'usertimeselect'});
		&ToHTML($member{'usertemplate'});
		&ToHTML($member{'userlanguage'});
		&ToHTML($member{'timeformat'});
</add before>
 



Wink
« Last Edit: Jun 28th, 2007 at 6:29pm by MF-B »  

Stand!
Back to top
IP Logged
 
Page Index Toggle Pages: 1 [2] 3 
Topic Tools
 
  « Board Index ‹ Board  ^Top