Author Topic: Export to HTML template produces odd characters  (Read 7079 times)

Offline bazography

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Export to HTML template produces odd characters
« on: September 27, 2014, 04:27:55 PM »
I use PM to export to an HTML template I’ve made, and that template pulls text from some of the IPTC fields. Some of the text ends up displaying oddly, like this:
These are “quotation marks”.
This is an apostrophe’

The above seems to be an issue with smart quotes, but there are also problems with accents, the degrees symbol (é and 68º) etc. I’m just wondering if there is something I can do from the PM end to allow these characters to be used or is this simply a limitation with HTML?

Thanks.

Mac OS 10.0.5, Photo Mechanic Version 5.0, build 15807 (38b559c)

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24756
    • View Profile
    • Camera Bits, Inc.
Re: Export to HTML template produces odd characters
« Reply #1 on: September 27, 2014, 05:17:39 PM »
I use PM to export to an HTML template I’ve made, and that template pulls text from some of the IPTC fields. Some of the text ends up displaying oddly, like this:
These are “quotation marks”.
This is an apostrophe’

The above seems to be an issue with smart quotes, but there are also problems with accents, the degrees symbol (é and 68º) etc. I’m just wondering if there is something I can do from the PM end to allow these characters to be used or is this simply a limitation with HTML?

Thanks.

Mac OS 10.0.5, Photo Mechanic Version 5.0, build 15807 (38b559c)

Could you post the HTML of one of the generated files that exhibits this behavior?

Thanks,

-Kirk

Offline bazography

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Export to HTML template produces odd characters
« Reply #2 on: September 29, 2014, 12:09:24 PM »
Here is a sample file...

[attachment deleted by admin]

Offline Odd Skjaeveland

  • Full Member
  • ***
  • Posts: 188
    • View Profile
Re: Export to HTML template produces odd characters
« Reply #3 on: September 29, 2014, 01:03:05 PM »
Here is a sample file...

The html code contains the following promise to the browser:
...content="text/html; charset=ISO-8859-1"

The content appears to be UTF-8 encoded.

I do not know if PM or the template is causing the mismatch as I never used the export to html functions.
If you designed the template, try modifying it to promise charset=UTF-8. If not, see if you can use ISO-8859-1 for the text.

--
Odd S.
--
Odd S.

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24756
    • View Profile
    • Camera Bits, Inc.
Re: Export to HTML template produces odd characters
« Reply #4 on: September 29, 2014, 01:39:00 PM »
What template produced that HTML?

The encoding must be UTF-8 in order to have non-ASCII characters represented correctly.

-Kirk

Offline bazography

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Export to HTML template produces odd characters
« Reply #5 on: October 03, 2014, 09:52:28 AM »
What template produced that HTML?

The encoding must be UTF-8 in order to have non-ASCII characters represented correctly.

-Kirk

It was actually years ago during the PM 4 era when I originally set this up so it's all a bit fuzzy, but I know for sure that the original template came from Camera Bits. I believe you had a sample template available, so I used that as my starting point and was able to modify it and insert my own graphic elements.

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24756
    • View Profile
    • Camera Bits, Inc.
Re: Export to HTML template produces odd characters
« Reply #6 on: October 03, 2014, 10:11:11 AM »
What template produced that HTML?

The encoding must be UTF-8 in order to have non-ASCII characters represented correctly.

It was actually years ago during the PM 4 era when I originally set this up so it's all a bit fuzzy, but I know for sure that the original template came from Camera Bits. I believe you had a sample template available, so I used that as my starting point and was able to modify it and insert my own graphic elements.

Post the template here and I'll fix it for you.

-Kirk

Offline bazography

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Export to HTML template produces odd characters
« Reply #7 on: October 03, 2014, 03:54:01 PM »


Post the template here and I'll fix it for you.

-Kirk

Greatly appreciated, thank-you Kirk. There's 2 parts to it, the index page and the preview page, so I've attached both. I'm guessing it has something to do with changing this part:
content="text/html; charset=ISO-8859-1"

I have a few other templates I've been playing with, so would you mind letting me know what you changed? Then I can fix the rest myself.

Thanks again...

Offline bazography

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Export to HTML template produces odd characters
« Reply #8 on: October 03, 2014, 03:56:12 PM »
I swore I attached the files, but I guess not... I'll try again...

[attachment deleted by admin]

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24756
    • View Profile
    • Camera Bits, Inc.
Re: Export to HTML template produces odd characters
« Reply #9 on: October 03, 2014, 05:55:12 PM »
I swore I attached the files, but I guess not... I'll try again...

I need the template that produced the two files you posted.  If I can change your template, it will fix the problem on all galleries you generate with the updated template.

If the template that produced this file is one of our templates then please let me know which one it is that you're using.

-Kirk

Offline Hayo Baan

  • Uber Member
  • ******
  • Posts: 2552
  • Professional Photographer & Software Developer
    • View Profile
    • Hayo Baan - Photography
Re: Export to HTML template produces odd characters
« Reply #10 on: October 03, 2014, 11:59:11 PM »
I'm guessing it has something to do with changing this part:
content="text/html; charset=ISO-8859-1"
To make your template work, change it to
Code: [Select]
content="text/html; charset=UTF-8"
I think that should do the trick.
Hayo Baan - Photography
Web: www.hayobaan.nl

Offline bazography

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Export to HTML template produces odd characters
« Reply #11 on: October 04, 2014, 02:12:26 PM »
I need the template that produced the two files you posted.  If I can change your template, it will fix the problem on all galleries you generate with the updated template.

If the template that produced this file is one of our templates then please let me know which one it is that you're using.

-Kirk

Sorry Kirk, but I'm confused now...
In PM preferences under "Location Of User HTML Templates", it points to the folder containing the files I sent you, so those ARE the templates used to generate the galleries... aren't they? The folder also contains a few other items (assets, index.htm, preview.htm, styles.css) but was quite sure you just needed the .htm files.

Unless you mean the original sample that I got from Camera Bits and modified? I found that, and will attach it in case that's what you're after. Strangely, I had a look at that sample and it contains "charset=UTF-8". How my files got changed to "charset=ISO-8859-1" I have no idea... this is a bit over my head so I can't imagine how/why I would have changed it.

Hayo suggests I would just need to change "ISO-8859-1" to "UTF-8"... if so I can certainly manage to fix that.

Thanks.

[attachment deleted by admin]

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 24756
    • View Profile
    • Camera Bits, Inc.
Re: Export to HTML template produces odd characters
« Reply #12 on: October 04, 2014, 06:37:53 PM »
I expect that the tools you used to edit/create the files set the encoding.  Did you use DreamWeaver?

Here are the updated files:


[attachment deleted by admin]

Offline bazography

  • Sr. Member
  • ****
  • Posts: 259
    • View Profile
Re: Export to HTML template produces odd characters
« Reply #13 on: October 04, 2014, 11:20:55 PM »
I expect that the tools you used to edit/create the files set the encoding.  Did you use DreamWeaver?

Here are the updated files:

Right you are, it was Dreamweaver. Thanks for your help!