svnno****@sourc*****
svnno****@sourc*****
2007年 9月 26日 (水) 19:45:23 JST
Revision: 175 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=175 Author: tach Date: 2007-09-26 19:45:22 +0900 (Wed, 26 Sep 2007) Log Message: ----------- url fixing Modified Paths: -------------- slashjp/trunk/Slash/Utility/Data/Data.pm slashjp/trunk/Slash/Utility/Display/Display.pm -------------- next part -------------- Modified: slashjp/trunk/Slash/Utility/Data/Data.pm =================================================================== --- slashjp/trunk/Slash/Utility/Data/Data.pm 2007-09-26 10:44:40 UTC (rev 174) +++ slashjp/trunk/Slash/Utility/Data/Data.pm 2007-09-26 10:45:22 UTC (rev 175) @@ -1455,17 +1455,7 @@ $codestr =~ s{<a href="[^"]+" rel="url2html-$$">(.+?)</a>}{$1}g; my $code = strip_code($codestr); my $newstr = "<blockquote>$code</blockquote>"; - # TODO: This 1-line fix for bug of perl in Debian sarge!? - # substr($str, $pos, $len) returns wrong string sometime. - # I tested both 5.8.4-8sarge3 and 5.8.4-8sarge4, - # In a test case, returned value have length=122. - # 5.8.4-8sarge3 works porperly when using substr as left value! - # However, 5.8.4-8sarge4 was broken in any case. - # - # I cannot find a way to reproduce surely, just stop to - # use 3rd argument, temporarily... - #substr($str, $pos, $len) = $newstr; - $str = substr($str, 0, $pos).$newstr.substr($str,$pos+$len); + substr($str, $pos, $len) = $newstr; pos($str) = $pos + length($newstr); } } @@ -2091,6 +2081,8 @@ $allowed .= '#'; sub fixurl { my($url) = @_; + no utf8; + Encode::is_utf8($url) and $url = Encode::encode_utf8($url); $url =~ s/([^$allowed])/$URI::Escape::escapes{$1}/og; $url =~ s/%(?![a-fA-F0-9]{2})/%25/g; return $url; @@ -2293,7 +2285,7 @@ if ($constants->{tweak_japanese}) { require Jcode; $text = [Jcode->new(Encode::encode_utf8($text), 'utf8')->jfold($length, '')]->[0]; - $text = Encode::decode('euc-jp', $text); + $text = Encode::decode('utf-8', $text); } else { $text = substr($text, 0, $length); } @@ -3068,7 +3060,8 @@ # This is the main reason for doing slashlinks at all! if ($ssi) { $url .= qq{$skin_root/}; - $url .= qq{$skin_name/$attr{sid}.shtml}; + $url .= qq{$skin_name/} unless ($skin_root =~ /\/${skin_name}$/); + $url .= qq{$attr{sid}.shtml}; $url .= qq{?tid=$attr{tid}} if $attr{tid}; $url .= qq{#$frag} if $frag; } else { Modified: slashjp/trunk/Slash/Utility/Display/Display.pm =================================================================== --- slashjp/trunk/Slash/Utility/Display/Display.pm 2007-09-26 10:44:40 UTC (rev 174) +++ slashjp/trunk/Slash/Utility/Display/Display.pm 2007-09-26 10:45:22 UTC (rev 175) @@ -539,8 +539,9 @@ # we don't NEED to do this ... 404.pl can redirect appropriately if necessary, # but we would need to `mv articles mainpage`, or ln -s, and it just seems better # to me to keep the same URL scheme if possible - my $skinname = $skin->{name} eq 'mainpage' ? '/articles' : ''; - $url .= "$skinname/" . ($story_link->{sid} || $story_ref->{sid}) . ".shtml"; + my $skinname = $skin->{name} eq 'mainpage' ? 'articles' : $skin->{name}; + $url .= "/$skinname" unless ($url =~ /\/${skinname}$/); + $url .= "/" . ($story_link->{sid} || $story_ref->{sid}) . ".shtml"; # manually add the tid(s), if wanted if ($constants->{tids_in_urls} && $params{tids}) { $url .= '?';