eZ Community » Forums » Developer » eZString::fromString() unsupported...
expandshrink

eZString::fromString() unsupported characters

eZString::fromString() unsupported characters

Tuesday 06 April 2010 3:57:28 pm - 2 replies

Hi,

I need to import articles. So, the articles include special characters within headline. I use eZContentObjectAttribute::fromString() method to set the content of the attribute.

For example, the "£" character (headline as eZString datatype):

Without encoding:

$contentObjectAttribute->fromString ( 'My £3M headline' );

Result: "My " (truncate string, either the url_alias: My)

With html entity encoding:

$contentObjectAttribute->fromString ( 'My £3M headline' );

Result: "My £3M headline" (unwashed character, either the url_alias: My-pound-3M-headline)

With utf8 encoding:

$contentObjectAttribute->fromString( 'My £3M headline' );

Result: "My £3M headline" (unwashed character, either the url_alias: My-163-3M-headline)

Of course, it happens with all unASCII characters.

Has anyone already dealt with this ?

Best regards,

Fabien.

Modified on Tuesday 06 April 2010 4:02:00 pm by John Doe

Tuesday 06 April 2010 5:22:37 pm

Hi Fabien,

I always use http://projects.ez.no/data_import which is fantastic and I really love it and I never had problems with clean UTF-8 and URLs and in german there are many Umlaute äüößÖÄÜ in headlines.

Perhaps a good idea to use a import framework?

Greetings, ekke

edited: typo

Modified on Tuesday 06 April 2010 5:23:11 pm by Ekkehard Dörre

Wednesday 07 April 2010 12:37:03 pm

Hi Ekke,

Thanks for your help.

I fixed my issue. The bug wasn't due to the eZPublish framework. It was due to the transition table I used.
I have to set

mysql_query( "SET NAMES UTF8" );

before the query to get the headline...

The encoding was wrong.

mb_detect_encoding()

return nothing instead of utf8.

Hope this issue can help anyone...

Regards,

Fabien.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from