%META:TOPICINFO{author="ProjectContributor" date="1734079732" format="1.1" version="1"}%
%META:TOPICPARENT{name="Plugins"}%
---+!! Pub Link Fixup Plugin

%FORMFIELD{"Description"}%

%TOC%

This plugin performs pub link fixup of the generated HTML page.  If Foswiki is configured with a
non-utf-8 ={Store}{Encoding}=, then links to /pub files will be generated with the incorrect encoding.

Even on non-utf-8 sites, Foswiki operates fully with UNICODE and utf-8 encoding in the core and on
the web interface.  /pub attachment links will be generated assuming the filesnames are utf-8 encoded.
This plugin provides a completePageHandler that finds utf-8 encoded links to /pub attachments and
re-encodes them to the {Store}{Encoding}.

Enable this plugin to perform the link fixup.  It can be safely enabled regardless of the ={Store}{Encoding}=.
If the Plugin detects that the ={Store}{Encoding}= is =utf-8=, it quietly disables its =completePageHandler=.

This is __not__ a complete fix to the issue.  It is still strongly recommended that sites convert
their Store to utf-8 to avoid these types of encoding issues.

---++ Preferences

This plugin has one expert setting.
   * ={Plugins}{PubLinkFixupPlugin}{Debug}=. Enable to record before/after of each rewritten link to the Foswiki debug log.

---++ Installation
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. "Extensions Operation and Maintenance" Tab -&gt; "Install, Update or Remove extensions" Tab.  Click the "Search for Extensions" button.  
Enter part of the extension name or description and press search.   Select the desired extension(s) and click install. If an extension is already installed, it will *not* show up in the
search results.

You can also install from the shell by running the extension installer as the web server user: (Be sure to run as the webserver user, not as root!)
<verbatim>
cd /path/to/foswiki
perl tools/extension_installer <NameOfExtension> install
</verbatim>

If you have any problems, or if the extension isn't available in =configure=, then you can still install manually from the command-line. See https://foswiki.org/Support/ManuallyInstallingExtensions for more help.


---++ Change History

%TABLE{columnwidths="7em" tablewidth="100%"}%
|  1.00 (14 Sep 2015): | Initial version |

%META:FORM{name="PackageForm"}%
%META:FIELD{name="Author" title="Author" value="George Clark"}%
%META:FIELD{name="Copyright" title="Copyright" value="2015, George Clark, All Rights Reserved"}%
%META:FIELD{name="Description" title="Description" value="For non-utf-8 sites, fix up Pub links to use correct encoding."}%
%META:FIELD{name="Home" title="Home" value="http://foswiki.org/Extensions/PubLinkFixupPlugin"}%
%META:FIELD{name="License" title="License" value="GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]])"}%
%META:FIELD{name="Release" title="Release" value="15 Mar 2026"}%
%META:FIELD{name="Repository" title="Repository" value="https://github.com/foswiki/distro"}%
%META:FIELD{name="Support" title="Support" value="http://foswiki.org/Support/PubLinkFixupPlugin"}%
%META:FIELD{name="Version" title="Version" value="1.00"}%
