nBill Community nBill Home Page
23/May/2012, 12:34:46 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Click Here for the nBill home page, or take a tour.  
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Contact names (in greek language) not splitted correctly after upgrade to 2.3.0  (Read 75 times)
weballdesign
Jr. Member
**
Offline Offline

Posts: 19


View Profile
« on: 01/February/2012, 09:57:19 PM »

Hi, I recently upgraded to 2.3.0.

Everything went ok, and database was updated as well. However contact names in greek were not shown correctly.
They missed a portion of their name.
Some showed only the part before the first space and
some showed the part before the first space and last 1 or 2 letters from the part after the first space

This problem occured only in names in greek character encoding and not in others in latin characters

Fortunately I took a backup before the upgrade. I realized that field jos_nbill_contact.name was splitted in jos_nbill_contact.first_name and jos_nbill_contact.last_name.

Since I had I a similar issue in a project I work on, trying to split a full name into first and last name, I did a google search and found some suggestions. However they were not splitting very well for greek characters, in fact some showed similar results like the ones I experience in jos_nbill_contact table

So ended up using this code that works well for both latin and utf-8 greek characters

It sets last_name to the name portion before 1st space
and first_name the portion after 1st space

Code:
UPDATE jos_nbill_contact c SET
 last_name =
      (SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(c.name, '  ', 1), '  ', -1)),
 first_name =
      (SELECT LTRIM(SUBSTR(c.name,instr(c.name,'  '))));
I thought I should share this info with you and help, in case it shows up to other users as well.

It might concern utf-8 encoding..


« Last Edit: 01/February/2012, 10:00:52 PM by weballdesign » Logged
netshine
Administrator
Hero Member
*****
Offline Offline

Posts: 4,563


View Profile
« Reply #1 on: 02/February/2012, 10:00:29 AM »

Thank you for sharing this.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!