Character encoding bug

mllr - February 15, 2009 - 13:49
Project:AMFPHP
Version:6.x-1.0-beta1
Component:Code
Category:feature request
Priority:normal
Assigned:snelson
Status:needs review
Description

The module destroys characters like ä, ö, ü... even though I changed the setCharsetHandler settings in gateway.php
I could fix it using the trick described in the following link:
http://blog.richardolsson.se/blog/2008/12/character-encoding-bug-in-amfp...

Thanks for upgrading anyway

#1

snelson - February 15, 2009 - 20:56
Assigned to:Anonymous» snelson
Status:active» postponed (maintainer needs more info)

Have you tried the new charset settings at admin/build/services/settings/amfphp.

I wonder then, should we just remove this line altogether as well as the configuration page? You tell me, I've never dealt with other encodings.

#2

mllr - February 16, 2009 - 15:00

…hmmm, I can’t find any charset settings under admin/build/services/settings/amfphp. Just the security options (use keys, use sessid). So my answer is no, I didn’t try those settings. But I think I don’t know what you mean, sorry.
I tried to solve the enconding with the setCharsetHandler-settings in amfphp’s gateway.php, but without success.
Right now I use "$gateway->setCharsetHandler( "utf8_decode", "ISO-8859-1", "ISO-8859-1" );" but it only works if I uncomment the same line in amfphp.module.

:-) Don’t ask me what to do, I’m not a PHP-Coder, not even an advanced Drupal-User, sorry. :-)

viele Grüße
Frank

#3

Dokuro - March 1, 2009 - 03:25

I had to change line 50 in the amfphp.module to

<?php
$gateway
->setCharsetHandler("iconv", "UTF-8", "UTF-8");
?>

To get Japanese to work before.

#4

097633 - March 13, 2009 - 16:30

thanks

#5

wouter99999 - May 4, 2009 - 19:54

I had the same problem and just deleted that line 50 to solve it. It seems that the module can receive data in utf8 and stores it correctly in drupal, but if it serves data, it converts the utf8 data from drupal into ISO-8859-1 (in line 50), which should not be done, because flex handles it as utf8.

#6

locdao - May 13, 2009 - 01:38

Just wanted to add that we had to do the same thing because line 50 was overriding anything being set in gateway.php

-Loc

#7

Bensbury - May 22, 2009 - 02:14

Hi,
Just chiming in.

I had the same problem with Japanese too and you have to take out line 50.
Once it's out everything runs peachy.

The explanation I read is that Drupal turns everything internally to UTF-8 already there is no need to decode it again as it is already UTF-8 out of Drupal and by AMF messing with it, it screws it up when it enters Flash.

So when I update the AMFPHP module I have to take out line 50.
I had to do this recently and the problem was I had forgotten that this was necessary as I had done it a long time ago.
After a lot of panicking I re-found the article on Drupal where some kind gent explains the problem.

#8

hans_dampfer - July 26, 2009 - 20:01

Hi,

I had the same problem with the german special-characters (Ö,Ä,Ü,ö,ä,ü)
I deleted that line 50 to solve it.

#9

perelman yuval - October 15, 2009 - 15:13
Status:postponed (maintainer needs more info)» needs review

i make a patch that add admin screen to the amfphp module, where you can control the charset handler, and change the problematic line 50 to :
$gateway->setCharsetHandler(variable_get('amfphp_charset_mode', 'iconv'), variable_get('amfphp_charset_phpCharset', 'UTF-8'), variable_get('amfphp_charset_sqlCharset', 'UTF-8'));

and make the default charset handler utf-8.

AttachmentSize
amfphp.module.patch 3.34 KB

#10

z.stolar - October 16, 2009 - 14:08
Status:needs review» needs work

@perelman yuval: The patch contains your .project file (eclipse?). You should remove it.
Apart from that - it does the work, and allows flexibility where it's needed.

#11

perelman yuval - October 18, 2009 - 21:37
Status:needs work» needs review

@z.stolar thanks for the comment , i removed the project file and upload the file again.

AttachmentSize
amfphp.module.patch 2.91 KB

#12

JuniorZ - October 27, 2009 - 14:11

I had to make the same (remove the line from the amfphp.module file).
I suggest do not force the charset, but let the user choose it in the file amfphp/gateway.php

#13

JuniorZ - October 27, 2009 - 14:16
Category:bug report» feature request

I suggest use a copy of /modules/amfphp/amfphp/gateway.php (named for example, modules/amfphp/amfphp/drupal-gateway.php) and require it in the file amfphp.module (maybe the file could be placed in drupal/sites/default/ for example)

#14

z.stolar - October 28, 2009 - 07:52

@JuniorZ: The patch in #11 saves the need of editing files, and makes it easy for people to test different encodings, until the desired result is achieved.

#15

Synthmax - November 6, 2009 - 19:18

GREAT, that worked for me with Danish Character to. Thanks

 
 

Drupal is a registered trademark of Dries Buytaert.