jasonrogena / jasonrogena/php-excel-reader

Character encoding issues

Open
#31 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
PHP
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
The HTML dump of the attached Excel file does not properly show either the
Russian text, or the Spanish text.

Two issues: an htmlentities() is done in dump(), regardless of string
encoding. Attached patch uses defaultEncoding as parameter for htmlentities.

The other issue is (from reading the Excel specs @openoffice.org) that what
is called asciiEncoding in the code, is actually compressed UTF-16LE (i.e.,
all high bytes stripped). The compressed string is usually ASCII for
regular characters, but not for accented characters. In the current
version, asciiEncoding strings are not encoded to the defaultEncoding,
thereby leaving the accented characters untranslated. Attached patch
re-inserts all high byte zeros, and always call encodeUTF16.

With these patches, the attached file displays properly in HTML, and the
example.xls from the source code also still seems to work.

PS: a big thank you for this library - we've been messing with the old one
for way too long over here :-)
```

Original issue reported on code.google.com by `her...@ozuzo.net` on 11 Jun 2009 at 7:02

Attachments:
- [encoding.patch](https://storage.googleapis.com/google-code-attachments/php-excel-reader/issue-31/comment-0/encoding.patch)
- [example2.xls](https://storage.googleapis.com/google-code-attachments/php-excel-reader/issue-31/comment-0/example2.xls)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing dump(), htmlentities(), defaultEncoding, asciiEncoding, and encodeUTF16 in the PHP reader. Compare the attached encoding.patch with the current implementation and use example2.xls plus example.xls to check Russian, Spanish, accented, and existing ASCII output. Done means both samples render correctly in HTML without regressing the existing example.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.