Moodle

URL string (not Hyperlink address) must convert to UTF-16LE in Excel output (Unicode)

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Won't Fix
  • Affects Version/s: 1.9.4
  • Fix Version/s: None
  • Component/s: Unicode
  • Labels:
    None
  • Environment:
    Excel format is Unicode (not Latin)
  • Affected Branches:
    MOODLE_19_STABLE

Description

In Bulk-user download, not-latin user gets wrong Excel file, since string in Url address column was not converted from ASCII to UTF-16LE. (Hyperlink address data is not needed to convert to UTF-16LE!)

function _writeUrlWeb($row1, $col1, $row2, $col2, $url, $str, $format = null)

$url is ASCII code, on the other hand, if $this->_BIFF_version equal 0x0600 (may be $this->_input_encoding == 'UTF-16LE'), $str is expected UTF-16LE. When $str is null, $str is copied from $url. $url is not UTF-16LE!

----------------------< patch >------------------
lib/pear/Spreadsheet/Excel/Writer/Worksheet.php

function _writeUrlWeb($row1, $col1, $row2, $col2, $url, $str, $format = null)
{
$record = 0x01B8; // Record identifier
$length = 0x00000; // Bytes to follow

if (!$format) { $format = $this->_url_format; }

// Write the visible label using the writeString() method.
if ($str == '') { $str = $url; }
// (Shirai126): From here
if ($this->_BIFF_version == 0x0600) {
if (function_exists('mb_detect_encoding') && (($enc = mb_detect_encoding($str)) != 'UTF-16LE')) { if (function_exists('mb_convert_encoding')) $str = mb_convert_encoding($str, 'UTF-16LE', $enc); }
}
// (Shirai126): To here
$str_error = $this->writeString($row1, $col1, $str, $format);
if (($str_error == -2) || ($str_error == -3)) { return $str_error; }

Activity

Hide
Michael de Raadt added a comment -

Thanks for reporting this issue.

We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

Michael d;

lqjjLKA0p6

Show
Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; lqjjLKA0p6
Hide
Michael de Raadt added a comment -

I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

Show
Michael de Raadt added a comment - I'm closing this issue as it appears to have become inactive and is probably not relevant to a current supported version. If you are encountering this problem or one similar, please launch a new issue.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: