Forums / Upgrading to 1.5.x / Handling of files and data containing ® (registered trademark symbol)

Handling of files and data containing ® (registered trademark symbol)

Started by swguy on 9 Aug 2012, 12:40 AM · Views: 2,881

Results 1 to 11 of 11
9 Aug 2012, 12:40 AM
#1
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,753
Plugin Contributions:
56

Handling of files and data containing ® (registered trademark symbol)

Zen Cart does not handle this well right now. For instance, a ® symbol in a file in html_includes will yield this error when the defines pages editor is used from admin:

[09-Aug-2012 00:35:33 UTC] PHP Warning: htmlspecialchars(): Invalid multibyte sequence in argument in /var/www/html/mysite/myadmin/define_pages_editor.php on line 188

... and the define page is blank in admin (since the default behavior of htmlspecialchars is to return nothing in the event of an error.)

This can be resolved by using ENT_IGNORE in the htmlspecialchars call in admin/define_pages_editor.php line 194.

Of course, there are a number of htmlspecialchars calls ... and unfortunately a lot of the cart's descriptions contain the registered trademark symbol.

Any other suggestions?

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

9 Aug 2012, 12:57 AM
#2
drbyte avatar

drbyte

Sensei

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

Re: Handling of files and data containing ® (registered trademark symbol)

What PHP version?
What CHARSET and DB_CHARSET ?

.
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.

9 Aug 2012, 1:01 AM
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,753
Plugin Contributions:
56

Re: Handling of files and data containing ® (registered trademark symbol)

PHP 5.3.10 (local) and 5.2.17 (on server);
CHARSET/DB_CHARSET utf8.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

9 Aug 2012, 1:08 AM
#4
drbyte avatar

drbyte

Sensei

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

Re: Handling of files and data containing ® (registered trademark symbol)

I'm not seeing any such characters in a fresh 1.5.0 install.
And inserting ® via the admin, saving, re-opening, saving, re-opening, etc, doesn't trigger any problems here. PHP 5.3.3 on this particular site.

Did your files come from an older version, based on iso-8859-1 character set?

.
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.

9 Aug 2012, 1:09 AM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,753
Plugin Contributions:
56

Re: Handling of files and data containing ® (registered trademark symbol)

Yes. Add an ® to a file in html_includes/YOUR_TEMPLATE using a text editor, then try to open it from defines pages editor.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

9 Aug 2012, 3:16 AM
#6
drbyte avatar

drbyte

Sensei

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

Re: Handling of files and data containing ® (registered trademark symbol)

Okay, when I use a text-editor and tell it to save the file as iso-8859-1 and add a multibyte character to it and save and then load it to my server and try to open it in Zen Cart which is set to UTF8, then I get the same problem.

And that's to be expected.

But if I set my editor to use UTF8 just like my Zen Cart is set to use UTF8, then I don't have any problem. And of course one should always use the same character-set / encoding consistently across all editing/storage platforms.

.
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.

9 Aug 2012, 4:24 AM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,753
Plugin Contributions:
56

Re: Handling of files and data containing ® (registered trademark symbol)

Fair enough. So really, what I should have done is just keep the whole system at iso-8859-1.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

22 Aug 2012, 4:34 PM
#8
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

Re: Handling of files and data containing ® (registered trademark symbol)

swguy:

Fair enough. So really, what I should have done is just keep the whole system at iso-8859-1.

Hey swguy!

I find it easiest with (r) and (c) and a number of symbols to just use the html equivalents. This really simplifies things for me.

® for (r)
© for (c)
™ for TM

-chadd

22 Aug 2012, 4:41 PM
#9
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,753
Plugin Contributions:
56

Re: Handling of files and data containing ® (registered trademark symbol)

I quite agree if you're starting from scratch - but in this case, the data already had these symbols littered throughout many many fields in the database.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

23 Aug 2012, 7:34 AM
#10
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,880
Plugin Contributions:
7

Re: Handling of files and data containing ® (registered trademark symbol)

what I should have done is just keep the whole system at iso-8859-1

Why? Can't you set the text editor to UTF-8?

I use Dreamweaver to generate/edit complex html for html_includes or Notepad++ or Sublime Text and all can be set to UTF-8 as default.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...