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.
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
...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.
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.
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.
Copy link to clipboard
Copied
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!