修正Twiki4.2.2的一个Bug

美国yahoo内部人员文档交流使用的的twiki页面是twiki页面,但是twiki对UTF-8汉字处理不太好,导致一些莫名其妙的问题,如字体从上到下,越来越大。为了解决这个症状,本人跟踪了一下这个原因,应该是twiki的一个bug。

我们知道在firefox里面字体url转码和不转码是没有什么区别的,但是在ie6下必须要url转码,否则ie6就会成为乱码,(ie7正常)于是:
1,修改TWiki/Render.pm文件:
找到函数:
sub makeAnchorName {
在函数末尾修改返回值为:
return urlEncode($anchorName);

接着在该函数后面加上函数urlEncode:

sub urlEncode {
    my $text = shift;
    $text =~ s/([^0-9a-zA-Z-_.:~!*'\/%])/'%'.sprintf('%02x',ord($1))/ge;
    return $text;
}

2,修改TWiki.pm文件:
找到函数:
sub _make_params {
修改:
$anchor .= '#' . shift( @args );

$anchor .= '#' . urlEncode(shift( @args ));
即可。


这次升级TWiki,我发现一个更加简单的修改这个Bug:

  • Version: TWiki 4.0.0-4.2.3+
  • Reason: display
  • You can use tool like vim etc. To edit the lib/TWiki/Render.pm, Add function urlEncodeIntercept (line 437) above sub _linkToolTipInfo {, like this:
    sub urlEncodeIntercept
{
my $text = shift;
$text = crypt($text, "salt");
return $text;
}
  • Find and change (line 427):
    return $anchorName;
  • to:
    return urlEncodeIntercept($anchorName);

Bug地址:http://twiki.org/cgi-bin/view/Main/SimToUtf8



Categories

| | 评论(2)

评论(2)

用sub urlEncode {
my $text = shift;
$text =~ s/([^0-9a-zA-Z-_.:~!*'\/%])/'%'.sprintf('%02x',ord($1))/ge;
return $text;
}

使用IE6访问时,apache2 报错:
view: Use of uninitialized value in substitution (s///) at /var/www/twiki/lib/TWiki/Render.pm line 435

line 235:
$text =~ s/([^0-9a-zA-Z-_.:~!*'\/%])/'%'.sprintf('%02x',ord($1))/ge;

你是怎么用的?我有新的patch了,只需要修改一个文件

发表评论

May 2010

            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          

关于此日记

此日记由 Cnangel 发表于 August 15, 2008 3:37 PM

此Blog上的上一篇日记PHP 4官方支持结束

此Blog上的下一篇日记使用和制作patch文件

首页归档页可以看到最新的日记和所有日记。

归档

Powered by Movable Type 5.02