Opened 7 years ago
Closed 7 years ago
#1462439 closed Bugs (fixed)
Patch to fix incorrect mbstring usage
| Reported by: | liels_bugs | Owned by: | roundcube |
|---|---|---|---|
| Priority: | 5 | Milestone: | |
| Component: | Interface | Version: | 0.1-beta2 |
| Severity: | critical | Keywords: | |
| Cc: |
Description
First of all, thanks for the great product! Hopefully my patch will help to make it more suitable for non-english people too. * * * program/include/main.inc contains two errors in mbstring usage. These errors prevent mbstring from using on non-english languages and cause empty body for messages with non-english character sets (like koi8-r or windows-1257). Firsts, this file determines if mbstring can be used at all and it does it by calling mb_language. This is wrong because this function is not right for this task. Suppose your display language is Latvian (mb_language returns false for "lv"). You get e-mail with Norwegian letters and charset. Now you are going to convert it to utf-8 but you cannot do it because you just disabled mbstring! And you did it by checking the language code that has nothing to do with incoming mail or display encoding. These are completely unrelated things! Second, code incorrectly works with mb_convert_encoding. It tries to check if encoding is directly supported by comparing it to arrays. This will work in some cases but not in all. Your code depends on the existance of mb_string_encodings, which is not always present. Thus you leave many charsets out. In fact, most of them for all PHP4 versions. Instead you should call mb_convert_encoding and compare result to empty string (read manual!). This is the only right way. I attach the patch that fixes mb_string usage and makes proper conversion. I did not look to anything else in the file, just fixed mbstring issues. Patch is verified on my test server. You make a great product - fast, nice looking and very promising. Hope you will succeed. I started to play with it 2 hours ago and already became a big fan :) Very, very good!
Attachments (1)
Change History (4)
comment:1 Changed 7 years ago by xpnet
- Severity set to critical
comment:2 Changed 7 years ago by ericliang
Please upload your patch in order for the rest of us to check your changes since we have similar issues with conversion of data in other languages.
comment:3 Changed 7 years ago by thomasb
- Resolution changed from None to fixed
- Status changed from assigned to closed
- Version changed from 0.1-rc1 to 0.1-beta2
Applied to trunk
Note: See
TracTickets for help on using
tickets.

Where can I download patch?