01518: Page name UTF-8 characters lost when login page used while creating new page

Summary: Page name UTF-8 characters lost when login page used while creating new page
Created: 2025-03-23 18:41
Status: Closed
Category: Bug
From: simon
Assigned:
Priority: 4
Version: 2.4.3
OS: W10 PHP 8.3.7

Description:
Using an UTF-8 instance of PmWiki
All pages have an edit password set
The user is logged out from all permissions

Try to create a new page, say https://example.nz/Test/TētahiWhārangi?action=edit in the address bar
PmWiki shows https://example.nz/Test/TētahiWhārangi?action=edit in the address bar and prompts for the password
Enter the password and click on Login
PmWiki shows https://example.nz/Test/T?hiWh?rangi?action=edit in the address bar

The UTF-8 characters have been lost
PmWiki displays "Editing Test.T" on the page

simon

PS note for some reason the browser changed the pasted URL characters copied from the address bar to "https://example.nz/Test/T%c4%93hiWh%c4%81rangi?action=edit". The page name is "TētahiWhārangi""

You can add this early to config.php: --Petko

# fix for international URLs on IIS
if (!empty($_SERVER['UNENCODED_URL'])) {
  $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
} elseif (!empty($_SERVER['HTTP_X_ORIGINAL_URL'])) {
  $_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_ORIGINAL_URL'];
} elseif (!empty($_SERVER['ORIG_PATH_INFO'])) {
  $_SERVER['REQUEST_URI'] = $_SERVER['ORIG_PATH_INFO'] . 
    (!empty($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '');
}

closed, this fixed the issue thanks, should it be in the core?

simon

I'm not comfortable automatically overwriting $_SERVER variables, I prefer this to only be enabled by an admin when it is safe. Unfortunately many recipes use $_SERVER['REQUEST_URI'] directly. This could be documented on the Cookbook pages about IIS. --Petko