• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Applying DW template to pages changes encoding

Community Beginner ,
Oct 02, 2012 Oct 02, 2012

Copy link to clipboard

Copied

I have turned PHP files that have been supplied to me into DW templates (CS5) since I need to test conversion of an existing site that uses consistent DW templates to use these mandated "templates". The PHP files that I was given are UTF-8 encoded (verified), HTML5, with the correct definition in the html.  When I create a new file to test, also HTML5 with UTF-8 encoding, both the templates and the files appear correctly in DW Live View and the browser. However, when I apply the template to the test page, the encoding gets changed to ANSI (as identified by Notepad++ ). As a result, accented characters are broken.  This does not happen with other files. PHP configuration on the server has default encoding set to UTF-8.

The PHP files contain many includes, as well as some jquery, and the server is IIS7 on a Win 2008 Server box (with PHP installed, of course). Does anyone have an idea what I should be looking for?  I'm assuming that it may be something in the php or even the js files that is causing the hiccup. But I won't be surprised if I have missed something simple and am not seeing the forest for the trees. Thanks for any help.

TOPICS
Server side applications

Views

926

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Oct 12, 2012 Oct 12, 2012

I seem to have accidentally stumbled upon a work-around - it makes not a lot of sense, but it does seem to tie in with the idea that the whole thing is a bug in Dreamweaver. (See thread at http://forums.adobe.com/message/2272888#2272888 )

When I checked page properties on all files, I also double-checked that the Unicode Normalization Form (in Page Properties) was set to C - which was the default - and never gave it much more thought.

Well, grasping at straws, I thought I'd try setting it (the tem

...

Votes

Translate

Translate
Community Expert ,
Oct 02, 2012 Oct 02, 2012

Copy link to clipboard

Copied

Do you have an encoding meta tag in the head section of your final outputted page that is being displayed by the browser?

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

It's an easy one to forget if you have a lot of includes being used to build the page. If it's missing, all the special characters will go haywire.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 02, 2012 Oct 02, 2012

Copy link to clipboard

Copied

Thanks, Jon, but yes, I do, as follows (HTML5)

<!DOCTYPE html>

<html lang="fr">

<head>

<meta charset="utf-8" />

The DW template itself is fine *before* applying it to the new page.  The new page to which I want to apply the DW template is correctly encoded too, both in the head, as above, and when I look at its actual encoding, before applying the DW template.  Only as I apply the template does the switch to ANSI happen.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 02, 2012 Oct 02, 2012

Copy link to clipboard

Copied

I should add that the meta tag does not change on application of the template. However, all accented characters break, and if you look at the file itself in Notepad++ it shows the encoding of the file itself to be ANSI.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 12, 2012 Oct 12, 2012

Copy link to clipboard

Copied

LATEST

I seem to have accidentally stumbled upon a work-around - it makes not a lot of sense, but it does seem to tie in with the idea that the whole thing is a bug in Dreamweaver. (See thread at http://forums.adobe.com/message/2272888#2272888 )

When I checked page properties on all files, I also double-checked that the Unicode Normalization Form (in Page Properties) was set to C - which was the default - and never gave it much more thought.

Well, grasping at straws, I thought I'd try setting it (the template) to KC instead, knowing that was *not* what I wanted, and confirming with the resultant files after the template was applied to a page that the behaviour of changing characters to entities was definitely not what I wanted; I want to get away from using character entities.

So I changed it back to C and re-saved the template.

For some reason - BINGO - once applied, the file's encoding was no longer changed to ANSI.

I and my co-worker tried it with numerous templates - each time a template file is left at the "correct" Unicode Normalization Form it gets changed to ANSI.  If we break it by changing to KC, and save it, then fix it by switching back to C, and save it again, it works as it should have in the first place.

Wonky but reasonably quick work-around, so I'm breathing a sigh of relief!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines