Single byte characters in string

Topics: Developer Forum, Project Management Forum, User Forum
Aug 17, 2012 at 6:20 AM


I created an excel file using the PHPExcel library. It works great.

When I open the excel file I created on a hex editor I can see a extra byte between each character of the strings in my excel file.

But if I open the same file I created with excel and resave it without editing, and then again open it using a hex editor those extra characters get disappear and I can see the continues string without extra byte between each character.

My requirement is to generate the excel file without those extra characters between each char of the string directly from the library. (without open and re-save it using excel)

Please help me. 

Thank you.

Aug 17, 2012 at 8:05 AM

PHPExcel always uses UTF-8 internally, and in saved files so that we're working with a standardised character set rather than the myriad of codepage sets that standard Excel works with. That's where those "extra" characters come from. If you want to get rid of them, then the file needs saving with the appropriate codepage, and not UTF-8. I'm afraid this is something that PHPExcel doesn't do, because of the complexities of converting everything between different codepages... the whole point of using a standard character set in the first place.

Why does your file need to be byte exact? This is an extremely unusual requirement... if you do have a valid business reason for it, then I'd suggest your only option is to use COM