Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of utf8_encode (deprecated in PHP 8.2) #598

Open
wants to merge 1 commit into
base: MOODLE_310_STABLE
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion classes/local/store/s3/client.php
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,13 @@ private function get_nice_filename($headers) {

if (!empty($originalfilename)) {
$result['Content-Disposition'] = $contentdisposition;
$result['filename'] = 'filename="' . utf8_encode($originalfilename) . '"';
// The filename parameter must be in ISO-8859-1, however it works in browsers if
// you treat the original UTF-8 string as ISO-8859-1 characters. To achieve that
// here, we encode the UTF-8 as if it were ISO-8859-1. This behaviour is hideous
// so it would be nice to use the optional filename* field (RFC 5987) but S3 still
// complains if we do that.
$jankyfilename = \core_text::convert($originalfilename, 'ISO-8859-1');
$result['filename'] = 'filename="' . $jankyfilename . '"';
$result['Content-Type'] = $originalcontenttype;
}
}
Expand Down
Loading