Changeset:
43abc59cf1c1
https://sourceforge.net/p/mrbs/hg-code/ci/43abc59cf1c18a5b712734439355eba3dc3326db
Author:
Campbell Morrison <[email protected]>
Date:
Wed Jan 13 14:21:34 2016 +0000
Log message:
Fixed bug in CSV reports when running on Windows (see SF Support Requests 860)
diffstat:
web/language.inc | 2 +-
web/report.php | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletions(-)
diffs (52 lines):
diff -r a1b97fe52dde -r 43abc59cf1c1 web/language.inc
--- a/web/language.inc Mon Jan 04 23:55:49 2016 +0100
+++ b/web/language.inc Wed Jan 13 14:21:34 2016 +0000
@@ -1134,7 +1134,7 @@
switch(utf8_strtolower($charset))
{
case 'utf-8':
- return "\xEF\xBB\xBF";
+ return pack('CCC', 0xEF, 0xBB, 0xBF);
break;
case 'utf-16':
return pack('S', 0xFEFF);
diff -r a1b97fe52dde -r 43abc59cf1c1 web/report.php
--- a/web/report.php Mon Jan 04 23:55:49 2016 +0100
+++ b/web/report.php Wed Jan 13 14:21:34 2016 +0000
@@ -327,6 +327,22 @@
}
+// Works out whether the machine architecture is little-endian
+function is_little_endian()
+{
+ static $result;
+
+ if (!isset($result))
+ {
+ $testint = 0x00FF;
+ $p = pack('S', $testint);
+ $result = ($testint===current(unpack('v', $p)));
+ }
+
+ return $result;
+}
+
+
// Converts a string from the standard MRBS character set to the character set
// to be used for CSV files
function csv_conv($string)
@@ -338,6 +354,13 @@
// standard (though it has the disadvantage that it adds in BOMs which we
have to remove)
if (function_exists('iconv'))
{
+ if ($out_charset == 'UTF-16')
+ {
+ // If the endian-ness hasn't been specified, then state it explicitly,
because
+ // Windows and Unix will use different defaults on the same architecture.
+ $out_charset .= (is_little_endian()) ? 'LE' : 'BE';
+ }
+
$result = iconv($in_charset, $out_charset, $string);
// iconv() will add in a BOM if the output encoding requires one, but as
we are only
// dealing with parts of a file we don't want any BOMs because we add them
separately
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits