php setlocale() & PHPExcel

Aug 8, 2008 at 8:07 AM
Today I opened a strainge feature. The following part of code works well on one server (Windows) and gets out a broken file under another (Unix).

<?php
setlocale(LC_ALL, "ru_RU.CP1251");
require_once  'PHPExcel/IOFactory.php';
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objPHPExcel = $objReader->load("template/invoice.xlsx");
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('invoice.xlsx');
?>

I was spending a half day trying to understand the reason and found it.
After commenting the first line the code works on both servers well.

What should I do to start this code under second server?
Developer
Aug 8, 2008 at 10:50 AM
There was a locale bug in PHPExcel 1.6.2, but that was fixed.

http://www.codeplex.com/PHPExcel/WorkItem/View.aspx?WorkItemId=6853

Are you using the latest source code?
Aug 11, 2008 at 7:48 AM
Hello!

Today I was downloading the latest sources (Change Set 15344 from 25, July).
But nothing was changed. As before writer works well only without setlocale() on UNIX server and with/without setlocale() on local Windows server.

I have uploaded both files in http://www.codeplex.com/PHPExcel/WorkItem/View.aspx?WorkItemId=6853