This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 197935 - Wrong Encoding Warning on HTML-Files - even NB7 own Templates
Summary: Wrong Encoding Warning on HTML-Files - even NB7 own Templates
Status: VERIFIED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Editor (show other bugs)
Version: 7.0
Hardware: PC Mac OS X
: P2 normal (vote)
Assignee: Marek Fukala
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-21 07:53 UTC by wegus
Modified: 2013-05-02 09:22 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
quick visual impression of the wrong warning (40.10 KB, image/jpeg)
2011-04-28 13:33 UTC, wegus
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wegus 2011-04-21 07:53:07 UTC
When creating an PHP-Project using the ISO 8859-1 Encoding, one get's Warnings in the Tasklist saying that Encoding Windows-1252 is obviously used whereas ISO 8859-1 is delclared in file.

Trying to enter and save a Euro-Sign ( which is Part of Windows 1252) leads to a Warning-Requester saying that the file contains at least on char that could not be saved using the chosen encoding of ISO 8859-1 and UTF-8 is suggested.

So we do have ISO 8859-1 for the files ( which can be easily prooved by any other editor) and a wrong HTML-Warning in NB7 and no Windows-1252 Encoding anywhere around.

Those Warnings do show up in elder Projects used with NB 6.9.1 as well as in new files, even those index.php generated by NB-Templates in brand new Projects. One can filter them away for sure, but this is not very comfortable. Especiallys when you want to use any other Task-filters anyway.

Would be very nice if this wrong encoding-warning could be removed in any further Patch.

I hav not tested yet wether this warning only shows up in the OS X-version or wether it will occur on LINUXes and Windows-machines too.
Comment 1 Petr Pisl 2011-04-28 12:37:16 UTC
So if I understand correctly, the steps to reproduce are:

1) Create php project with iso-8859-1 encoding
2) in a file (index.php for example) place the Euro-sign € and the task window will show the warning?

I'm not able to somehow reproduce. Could you confirm the steps to reproduce?
Comment 2 wegus 2011-04-28 13:24:47 UTC
Hi Petr,

you can reproduce it much easier [ well i can ;-) ] :

(1) Start NB7
(2) Create a brand new PHP Application Project using PHP 5.3 and Encoding 8859-1
    i called it "encodingtroubleproject". Don't chnange anything else. Let NB
    create the project.
(3) Open the autogenerated index.php and you have got the Warning right now,       befor you do enter any text in line 1 in the PHP-Editor!


So either the Warning is wrong or NB7 itself created an index.php-File using Encoding windows-1252 when ISO 8859-1 was asked. Properties of the project di show the desired 8859-1, but any Script-File either autogenerated or newly created will get this warning. Even elder files that work correctly with NB 6.9.1 get this warning!

I do have this problem on 2 Macs, both Intel Macs ( core2duo) both with Snow-Leopard as OS and both with all patches done!


P.S.: we just cross-checked this on a debian squeeze machine running NB7. This machine had no NB7 installed befor. When doing the same 3 Steps then above you do get this Warning.
It seems that this wrong warning only appears when you choose to do an Project with 8859-1 Encoding. Doing so using UTF-8 will not cause any such Warning.
Comment 3 wegus 2011-04-28 13:33:31 UTC
Created attachment 107998 [details]
quick visual impression of the wrong warning
Comment 4 Petr Pisl 2011-04-28 14:15:02 UTC
Hmm, it looks like an html warning which I'm not able to obtain.

Marek, have you seen this?
Comment 5 wegus 2011-04-28 14:40:12 UTC
sorry for contacting the wrong Maintainer Petr and thank you for forwarding it to to someon doing the HTML-Warnings!
Comment 6 Petr Pisl 2011-05-02 14:42:48 UTC
Reassigning to Marek. This is really html validator issue. I don't understand, where it takes the ecnoding Windows-1252 ( probably somehow hardcoded?)
Comment 7 Marek Fukala 2011-05-02 16:02:37 UTC
The information message just gives you the info that the browsers should treat the file as windows-1252 instead of iso-8859-1 as the w3c specification says:

http://dev.w3.org/html5/spec/Overview.html#character-encodings-0

The message however doesn't influence the file encoding itself, so the editor still uses the iso-8859-1.

I believe the message can be kept as it is, but it is questionable whether to put such messages to the tasklist or not.
Comment 8 wegus 2011-05-03 06:33:11 UTC
>I believe the message can be kept as it is, but it is questionable whether to
>put such messages to the tasklist or not.

Hey this is great!
So we got two points here:

(1) The Warning tells something important 
I didn't know this encoding guidelines up to now. It is great that netbeans checks such things and it's good to communicate that with a warning. As we see here the Text of the warning will not be understood. There should be a more precise Text within the warning. Something like:

"You chose to use ISO 8859-1, be aware that your webserver has to deliver this site as windows 1252 according to w3c rules!"


(2) The Tasklist
is something i try to work clean. As we all know Apps or Skripts do show Side-Effects. Sometimes caused by simple warnings ( as encoding topics). So good Code is Tasklist free! For PHP/HTML/Javascript Netbeans Warnings are very usefull. So it annoys if such useless tasks as this warning show up. You'll get this warning per file. If your project consists of 1000 files, you'll get 1000 senseless tasks!

So please: i would appreciate if you remove the warning from the tasklist and it would be great to have a more precise explanation in the warning text!


Thanx for your help&time :-)
Comment 9 Marek Fukala 2011-05-03 07:10:27 UTC
I'll try to handle the problem somehow. Meanwhile you may use the tasklist filter to filter the message out.
Comment 10 wegus 2011-05-03 07:23:55 UTC
yepp, that's what i do at the moment!

Thank you for showing me this W3C Rule i didn't know! 

Propably it would be a solution to reduce such a warning as one warning per project. Encoding is a Project-Setting. If you choose an ISO 8859-1 Encoding for your project one warning for the whole project (and one entry in the tasklist) would do the job!

In my case i do have an intranet here, running on local servers, written over the last 12 years in PHP (and Java for last four years). Servers an Clients do use 8859-1 and the newer UTF-8 and this is it. One Warning for the project would be okay, one warning per file is overkill i think!
Comment 11 Marek Fukala 2011-05-04 14:47:25 UTC
fixed in web-main#081b2f1f1b46

The html validator error checks are now configurable to some extent. I plan to do much more fine grained customization options for 7.1, but the current changes should cover the problem described in the issue.

There are some new hints options for HTML language in the editor options. There are three new subcategories of Html Validator category - Encoding issues, Tags matching issues and Others. 

You may enable/disable the particular hint or change its severity. If a hint is disabled, the tasklist should also does not show the errors from its category. The severity set in the hints options won't be reflected in the tasklist (will be implemented for 7.1). There will be a separate checkbox in "Show in tasklist" for each hint in 7.1 as well so it will be possible to have the hint enabled just for the editor and not for tasklist.

It may happen that some of the error messages from the validator are not properly added to the hint category (there's no central registry of the messages in the validator so I have to do some pattern recognition on the messages text). If you find such, please report it in a new issue. Thanks.
Comment 12 wegus 2011-05-04 20:21:50 UTC
thank you for your great work!
I'm looking forward for the next patch release containing all those features!
Comment 13 Quality Engineering 2011-05-05 05:54:51 UTC
Integrated into 'main-golden', will be available in build *201105050000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/081b2f1f1b46
User: Marek Fukala <mfukala@netbeans.org>
Log: #197935 - Wrong Encoding Warning on HTML-Files - even NB7 own Templates ; #197145 - Html validator doesn't flag a file as erroneous
Comment 14 Vladimir Riha 2011-07-25 10:44:13 UTC
verified

Product Version: NetBeans IDE 7.0.1 (Build 201107211357)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 15 localhorst 2013-05-02 09:22:57 UTC
I am not sure if this is the right place for my issue - please comment if not.

I get warnings about ivalid encoding when opening template files (e.g., in Smarty):

"The encoding [{$oView->getCharSet()}] specified in meta tag of the  document base.tpl is invalid. Do you want to load the file using  UTF-8 encoding?"

Usually I work around this message by replacing the charset variable with the string "utf-8". But it would be nice to tell the HTML editor to ignore invalid charset tags in the options dialogue.

See this questions over at Stackoverflow: http://stackoverflow.com/q/15948553/283854