Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Item13378: more fixes for unicode
  • Loading branch information
Comment committed May 14, 2015
1 parent a6a1a11 commit 3daf5fc
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 22 deletions.
6 changes: 3 additions & 3 deletions RCSStoreContrib/lib/Foswiki/Store/Rcs/RcsLiteHandler.pm
Expand Up @@ -268,7 +268,7 @@ sub _ensureRead {
$this->{state} = 'nocommav';
return;
}
binmode($fh);
binmode( $fh, $Foswiki::UNICODE ? ':utf8' : undef );

my $state = 'admin.head'; # reset to start
my $term = ';';
Expand Down Expand Up @@ -422,7 +422,7 @@ sub _formatString {
my ($str) = @_;
$str ||= '';
$str =~ s/@/@@/go;
return '@' . Foswiki::Store::Rcs::Handler::encode($str) . '@';
return '@' . $str . '@';
}

# Write content of the RCS file
Expand Down Expand Up @@ -560,7 +560,7 @@ sub _writeMe {
'Cannot open ' . $this->{rcsFile} . ' for write: ' . $! );
}
else {
binmode($out);
binmode( $out, $Foswiki::UNICODE ? ':utf8' : undef );
_write( $this, $out );
close($out);
}
Expand Down
4 changes: 3 additions & 1 deletion RCSStoreContrib/test/unit/RCSStoreContrib/RCSHandlerTests.pm
Expand Up @@ -371,7 +371,9 @@ sub verify_simple14 {

sub verify_simple15 {
my $this = shift;
$this->checkGetRevision( [ "a" . chr(0xFF), "b" . chr(0xFF) ] );
use utf8;
$this->checkGetRevision( [ "aŠňáĺľ", "bŠňáĺľ" ] );
no utf8;
}

sub verify_simple16 {
Expand Down
Expand Up @@ -389,10 +389,9 @@ our $encoded_nbsp;
# Given a unicode string, decode all entities in it that can be mapped
# to the current site encoding
sub decodeRepresentableEntities {
my $str = shift;

# Expand entities
HTML::Entities::decode_entities($str);
HTML::Entities::decode_entities( $_[0] );

unless ( defined $encoded_nbsp ) {
$encoded_nbsp = ' ';
Expand All @@ -401,9 +400,7 @@ sub decodeRepresentableEntities {
}

# Replace expansion of   with $WC::NBSP
$str =~ s/$encoded_nbsp/$WC::NBSP/g;

return $str;
$_[0] =~ s/$encoded_nbsp/$WC::NBSP/g;
}

# DEBUG
Expand Down
2 changes: 1 addition & 1 deletion core/data/TestCases/TestCaseAutoFormattedSearch.txt
Expand Up @@ -84,7 +84,7 @@ Forma...
---++ Expected

<!-- expected with $parent -->
Revision 4 has parent <nop>TestCaseAutoFormattedSearch and it contains the form <nop>FormattedSearchForm
Revision 1 has parent <nop>TestCaseAutoFormattedSearch and it contains the form <nop>FormattedSearchForm
<!-- /expected -->

---++ Actual
Expand Down
16 changes: 8 additions & 8 deletions core/data/TestCases/TestCaseAutoFormattedSearchDetails.txt
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="BaseUserMapping_333" date="1246078286" format="1.1" version="1.1"}%
%META:TOPICINFO{author="ProjectContributor" date="1246078286" format="1.1" version="1.1"}%
%META:TOPICPARENT{name="WebHome"}%
---+!! %TOPIC%
Description: Automated formatted search tests verifying refactor of format= functionality in foswiki 1.1
Expand All @@ -17,14 +17,14 @@ The major risk is the default formatting where web's are separated - for paging
<h4 class="foswikiSearchResultsHeader" style="border-color:#FFEFA6"><b>Results from Main web</b> retrieved at @TIME (@REX(GMT|Local)</h4>
<div class="foswikiSearchResult"><div class="foswikiTopRow">
<a href="%SCRIPTURLPATH{"view"}%/Main/WebHome"><b>WebHome</b></a>
<div class="foswikiSummary">Welcome to the web Congratulations, you have finished installing Foswiki. This site is running Foswiki release *, Plugin API version * To learn more about Foswiki ...</div></div>
<div class="foswikiSummary">Welcome to the web Congratulations, you have finished installing Foswiki. This site is running Foswiki release *, Plugin API version * To learn more about Foswi...</div></div>
<div class="foswikiBottomRow">
<span class="foswikiSRRev"><span class="foswikiNew">NEW</span> - <a href="%SCRIPTURLPATH{"rdiff"}%/Main/WebHome" rel='nofollow'>@DATE - @TIME</a></span> <span class="foswikiSRAuthor">by <a href="%SCRIPTURLPATH{"view"}%/%USERSWEB%/@WIKIWORD">@WIKIWORD</a> </span>
</div>
</div>
<div class="foswikiSearchResult"><div class="foswikiTopRow">
<a href="%SCRIPTURLPATH{"view"}%/Main/WebPreferences"><b>WebPreferences</b></a>
<div class="foswikiSummary">Main Web Preferences Appearance * Set WEBBGCOLOR = #FFEFA6 * web specific background color, current color * Set SITEMAPLIST = on * Set WEBSUMMARY ...</div></div>
<div class="foswikiSummary">Main Web Preferences Appearance * Set WEBBGCOLOR = #FFEFA6 * web specific background color, current color * Set SITEMAPLIST = on * Set WEBSUMMAR...</div></div>
<div class="foswikiBottomRow">
<span class="foswikiSRRev"><span class="foswikiNew">NEW</span> - <a href="%SCRIPTURLPATH{"rdiff"}%/Main/WebPreferences" rel='nofollow'>@DATE - @TIME</a></span> <span class="foswikiSRAuthor">by <a href="%SCRIPTURLPATH{"view"}%/%USERSWEB%/@WIKIWORD">@WIKIWORD</a> </span>
</div>
Expand All @@ -48,7 +48,7 @@ The major risk is the default formatting where web's are separated - for paging
</div>
<div class="foswikiSearchResult"><div class="foswikiTopRow">
<a href="%SCRIPTURLPATH{"view"}%/Sandbox/WebPreferences"><b>WebPreferences</b></a>
<div class="foswikiSummary">Sandbox Web Preferences Appearance * Set WEBBGCOLOR = #FFD8AA * Set WEBSUMMARY = * Set SITEMAPLIST = on Wiki application settings * WebTopicEditTemplate ...</div></div>
<div class="foswikiSummary">Sandbox Web Preferences Appearance * Set WEBBGCOLOR = #FFD8AA * Set WEBSUMMARY = * Set SITEMAPLIST = on Wiki application settings * WebTopicEditTem...</div></div>
<div class="foswikiBottomRow">
<span class="foswikiSRRev"><span class="foswikiNew">NEW</span> - <a href="%SCRIPTURLPATH{"rdiff"}%/Sandbox/WebPreferences" rel='nofollow'>@DATE - @TIME</a></span> <span class="foswikiSRAuthor">by <a href="%SCRIPTURLPATH{"view"}%/%USERSWEB%/@WIKIWORD">@WIKIWORD</a> </span>
</div>
Expand All @@ -65,14 +65,14 @@ The major risk is the default formatting where web's are separated - for paging
<h4 class="foswikiSearchResultsHeader" style="border-color:#B9DAFF"><b>Results from System web</b> retrieved at @TIME (@REX(GMT|Local)</h4>
<div class="foswikiSearchResult"><div class="foswikiTopRow">
<a href="%SCRIPTURLPATH{"view"}%/%SYSTEMWEB%/WebHome"><b>WebHome</b></a>
<div class="foswikiSummary">Welcome to the System Web This is where Foswiki keeps system documentation, including documentation that is included with optional extensions. For most people, the ...</div></div>
<div class="foswikiSummary">Welcome to the System Web This is where Foswiki keeps system documentation, including documentation that is included with optional extensions. For most people, th...</div></div>
<div class="foswikiBottomRow">
<span class="foswikiSRRev"><span class="foswikiNew">NEW</span> - <a href="%SCRIPTURLPATH{"rdiff"}%/%SYSTEMWEB%/WebHome" rel='nofollow'>@DATE - @TIME</a></span> <span class="foswikiSRAuthor">by <a href="%SCRIPTURLPATH{"view"}%/%USERSWEB%/@WIKIWORD">@WIKIWORD</a> </span>
</div>
</div>
<div class="foswikiSearchResult"><div class="foswikiTopRow">
<a href="%SCRIPTURLPATH{"view"}%/%SYSTEMWEB%/WebPreferences"><b>WebPreferences</b></a>
<div class="foswikiSummary">System Web Preferences Appearance * Set WEBBGCOLOR = #B9DAFF * Set SITEMAPLIST = on * Set WEBSUMMARY = * Set NOAUTOLINK = off TOC settings * Set ...</div></div>
<div class="foswikiSummary">System Web Preferences Appearance * Set WEBBGCOLOR = #B9DAFF * Set SITEMAPLIST = on * Set WEBSUMMARY = * Set NOAUTOLINK = off TOC settings * ...</div></div>
<div class="foswikiBottomRow">
<span class="foswikiSRRev"><span class="foswikiNew">NEW</span> - <a href="%SCRIPTURLPATH{"rdiff"}%/%SYSTEMWEB%/WebPreferences" rel='nofollow'>@DATE - @TIME</a></span> <span class="foswikiSRAuthor">by <a href="%SCRIPTURLPATH{"view"}%/%USERSWEB%/@WIKIWORD">@WIKIWORD</a> </span>
</div>
Expand All @@ -89,14 +89,14 @@ The major risk is the default formatting where web's are separated - for paging
<h4 class="foswikiSearchResultsHeader" style="border-color:yellow"><b>Results from TestCases web</b> retrieved at @TIME (@REX(GMT|Local)</h4>
<div class="foswikiSearchResult"><div class="foswikiTopRow">
<a href="%SCRIPTURLPATH{"view"}%/TestCases/WebHome"><b>WebHome</b></a>
<div class="foswikiSummary">TestCases Web If you are here, you want to test this version of Foswiki. This web is held in the Foswiki Subversion repository, so: 1 You must manually ensure that ...</div></div>
<div class="foswikiSummary">TestCases Web If you are here, you want to test this version of Foswiki. This web is held in the Foswiki Subversion repository, so: 1 You must manually ensure ...</div></div>
<div class="foswikiBottomRow">
<span class="foswikiSRRev"><span class="foswikiNew">NEW</span> - <a href="%SCRIPTURLPATH{"rdiff"}%/TestCases/WebHome" rel='nofollow'>@DATE - @TIME</a></span> <span class="foswikiSRAuthor">by <a href="%SCRIPTURLPATH{"view"}%/%USERSWEB%/@WIKIWORD">@WIKIWORD</a> </span>
</div>
</div>
<div class="foswikiSearchResult"><div class="foswikiTopRow">
<a href="%SCRIPTURLPATH{"view"}%/TestCases/WebPreferences"><b>WebPreferences</b></a>
<div class="foswikiSummary">TestCases Web Preferences * Set BROADCASTMESSAGE = NOTE: This is the TestCases web. You cannot edit any topic named "TestCase..." or "Web..." in this web, you can ...</div></div>
<div class="foswikiSummary">TestCases Web Preferences * Set BROADCASTMESSAGE = NOTE: This is the TestCases web. You cannot edit any topic named "TestCase..." or "Web..." in this web, you ca...</div></div>
<div class="foswikiBottomRow">
<span class="foswikiSRRev"><span class="foswikiNew">NEW</span> - <a href="%SCRIPTURLPATH{"rdiff"}%/TestCases/WebPreferences" rel='nofollow'>@DATE - @TIME</a></span> <span class="foswikiSRAuthor">by <a href="%SCRIPTURLPATH{"view"}%/%USERSWEB%/@WIKIWORD">@WIKIWORD</a> </span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/Meta.pm
Expand Up @@ -3436,7 +3436,7 @@ sub _summariseTextSimple {
my ( $this, $text, $limit ) = @_;
_assertIsTopic($this) if DEBUG;

$text =~ s/^(.{$limit}.*?)([[:alnum:]]).*$/$1$2.../s;
$text =~ s/^(.{$limit}).*$/$1.../s;

return $this->_makeSummaryTextSafe($text);
}
Expand Down
4 changes: 2 additions & 2 deletions core/lib/Foswiki/Render.pm
Expand Up @@ -359,8 +359,8 @@ sub getRenderedVersion {

# '#WikiName' anchors. Don't attempt to make these unique; renaming
# user-defined anchors is not sensible.
$text =~
s/^(\#$Foswiki::regex{wikiWordRegex})/'<span id="'.$anchors->add( $1 ).'" \/>'/gem;
$text =~ s{^(\#$Foswiki::regex{wikiWordRegex})}
{'<span id="'.$anchors->add( $1 ).'"></span>'}gem;

# Headings
# '<h6>...</h6>' HTML rule
Expand Down
2 changes: 1 addition & 1 deletion core/lib/Foswiki/UI/Save.pm
Expand Up @@ -177,7 +177,7 @@ sub buildNewTopic {
$ancestorRev = 0;
}

$text = $query->param('text');
$text = $query->param('text') if scalar $query->param('text');
if ( defined $text ) {

# text is defined in the query, save that text, overriding anything
Expand Down

0 comments on commit 3daf5fc

Please sign in to comment.