Forums / Installing on a Linux/Unix Server / EXACT collation please?

EXACT collation please?

Started by s_mack on 16 Jun 2012, 6:07 PM · Views: 1,789

Results 1 to 8 of 8
16 Jun 2012, 6:07 PM
#1
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

EXACT collation please?

Installing a fresh 1.5

I've had problems in the past with foreign chars not displaying correctly in some areas. So from the beginning I want the correct settings. I have customers from around the globe entering addresses the way THEY want to and I need it to record correctly.

During setup it asks me to choose between UTF-8 and Latin1, but when I'm creating the database I get dozens of options. So utf8_general_ci? utf8_bin_ci? utf8_unicode_ci? latin1_bin_ci? latin1_general_ci? latin1_general_cs?

  • Steven
16 Jun 2012, 6:37 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: EXACT collation please?

If you're using UTF8, then the preferred collation to use when CREATING A NEW DATABASE is utf8_general_ci or utf8_unicode_ci

For Latin1/iso-8859-1 you want latin1_general_ci

Basically you want the "_general_ci" version if possible.

NOTE: The "ci" means "case-insensitive", and if you use "cs" instead then your searches won't work.

Any good hosting company already has that set as the server default so that the user just supplies a database name and goes from there.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Jun 2012, 6:42 PM
#3
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: EXACT collation please?

Thanks.

However, I was just reading a few articles and postings while I waited for your answer... Several people say that you should use unicode and not general. General is fast but inaccurate and unicode isn't perceivably slower anyway. The suggestion in general being: if you support foreign charsets, you should actually support them correctly.

Any harm in using it?

If so... just a thought that maybe you guys should look at it for a future revision. I'll leave it with you.

  • Steven
16 Jun 2012, 6:44 PM
#4
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: EXACT collation please?

just a p.s. it look like my host default is utf8_unicode_ci but I have a choice of dozens.

16 Jun 2012, 6:56 PM
#5
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: EXACT collation please?

DrByte:

when CREATING A NEW DATABASE is utf8_general_ci

Can I ask, why did you stress that point so strongly??

I am working on a fresh copy with a new DB, but if I were upgrading from one that was using Latin, what's the difference?

16 Jun 2012, 7:05 PM
#6
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: EXACT collation please?

s_mack:

Several people say that you should use unicode and not general. General is fast but inaccurate and unicode isn't perceivably slower anyway. The suggestion in general being: if you support foreign charsets, you should actually support them correctly.

Any harm in using it?
Good point. Probably one worth following.

Haven't had any negative run-ins with using general vs unicode myself, so can't comment from experience. But I suspect the advice you're reading about using unicode instead of general for utf8 is correct. Use it.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Jun 2012, 7:07 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: EXACT collation please?

s_mack:

DrByte:

when CREATING A NEW DATABASE is utf8_general_ciCan I ask, why did you stress that point so strongly??

I am working on a fresh copy with a new DB, but if I were upgrading from one that was using Latin, what's the difference?
Because upgrading is a whole different kettle of fish. And way beyond the topic of this discussion thread.
You can't just change the characterset or collation on a database and have it change everything IN the database.
It's not a simple "flip the switch".

Hence: http://www.zen-cart.com/content.php?313-should-i-convert-my-store-from-iso-8859-1-to-utf8

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

16 Jun 2012, 7:16 PM
#8
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: EXACT collation please?

Thanks!