CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Street address getting truncated at first instance of a non-ASCII character
Pages: [1]

Author Topic: Street address getting truncated at first instance of a non-ASCII character  (Read 960 times)

nkinkade

  • I post occasionally
  • **
  • Posts: 56
  • Karma: 5
Street address getting truncated at first instance of a non-ASCII character
July 15, 2010, 04:25:46 pm
I'm trying to add a contact whose street address has a non-ASCII character and for some reason it's getting truncated at the non-ASCII character somewhere along the way.  I run the following:

require_once 'CRM/Contact/BAO/Contact.php';
$contact = CRM_Contact_BAO_Contact::create($params)

Where the [address] section of $params looks like:

Code: [Select]
[address] => Array
        (
            [1] => Array
                (
                    [address_name] => First Last
                    [street_address] => Speranskijvägen 10 A 22
                    [city] => Helsinki
                    [state_province] => State
                    [postal_code] => 12345
                    [country] => XX
                )

        )

Yet in the database the street address is truncated to "Speranskijv".  Before I spend too much time tracking this down, does anyone have any ideas about where the problem is occurring?

Thanks,

Nathan

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Street address getting truncated at first instance of a non-ASCII character
July 16, 2010, 11:33:45 am
Is PHP compiled on your server to support Unicode?  Check with your server administrator.
Try CiviTeacher: the online video tutorial CiviCRM learning library.

nkinkade

  • I post occasionally
  • **
  • Posts: 56
  • Karma: 5
Re: Street address getting truncated at first instance of a non-ASCII character
July 16, 2010, 11:50:12 am
I am the server administrator.  I wasn't aware that support for Unicode was something that could be compiled into PHP.  In fact, I'm not aware that PHP 5 natively supports Unicode at all.  We have other data in our system that with non-ASCII characters ... contact names, cities, etc.  I'm not sure why it's not functioning here.

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Street address getting truncated at first instance of a non-ASCII character
July 16, 2010, 12:00:44 pm
Unicode may or may not be the problem, but it is something to check and cross off the list.  Multi-language support comes to mind as a possible culprit as well.

Here is a link from this page: http://homeofficekernel.blogspot.com/2009/01/centos4-and-civicrm-21.html

    * The CiviCRM installer insists on PHP 5.2.x
    * CiviCRM requires a version of PCRE with unicode

Although CentOS (which what I use) and many other Linux distributions doesn't come with unicode, you could try recompiling PHP with PCRE.  Lack of unicode support in PHP could cause annoying warnings at best or failure to intepret non-Western characters at worst.
Try CiviTeacher: the online video tutorial CiviCRM learning library.

nkinkade

  • I post occasionally
  • **
  • Posts: 56
  • Karma: 5
Re: Street address getting truncated at first instance of a non-ASCII character
July 16, 2010, 12:04:40 pm
We're using PHP 5.2.6 and it is compiled with PCRE support.  We run all Debian Lenny boxes, and we've never had any issue with PHP and unicode anywhere else.  The problem is nearly certainly somewhere else.

nkinkade

  • I post occasionally
  • **
  • Posts: 56
  • Karma: 5
Re: Street address getting truncated at first instance of a non-ASCII character
July 16, 2010, 03:59:09 pm
Just to follow up on this ... I traced this all the way down to MySQL and eventually turned on MySQL SQL logging only to find that MySQL appear to be receiving the correct string, but somehow MySQL appears to be truncating the string.  Everything about the server/client/connection, database, table and field is UTF8.  I guess I'll keep poking around with the MySQL server.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Street address getting truncated at first instance of a non-ASCII character

This forum was archived on 2017-11-26.