Open
Bug 410628
Opened 17 years ago
Updated 2 years ago
script does not work in UTF-16 svg file
Categories
(Core :: SVG, defect)
Tracking
()
REOPENED
People
(Reporter: A.Mueller, Unassigned)
References
()
Details
Attachments
(2 files)
96.13 KB,
application/x-zip-compressed
|
Details | |
814 bytes,
patch
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b3pre) Gecko/2008010211 Minefield/3.0b3pre
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9b3pre) Gecko/2008010211 Minefield/3.0b3pre
there is an iso-8859-1 javascript referenced in an UTF-16 svg file with
<script xlink:href="viewboxtile.js" type="text/ecmascript" charset="iso-8859-1"/>
This produce the error "Error: illegal character"
Works OK with IE, Opera and Safari
Reproducible: Always
Steps to Reproduce:
1. start URL
2. show Error console
3.
Actual Results:
Error "Error: illegal character"
Expected Results:
No error
works with IE, Opera and Safari. Do not work with FF2 and FF3
Reporter | ||
Updated•17 years ago
|
Component: General → SVG
Product: Firefox → Core
Reporter | ||
Updated•17 years ago
|
Version: unspecified → Trunk
Updated•17 years ago
|
QA Contact: general → general
Comment 1•17 years ago
|
||
Does this happen if you have a UTF-16 xhtml file and reference the same iso-8859-1 javascript file? If so you should probably change the component to something more appropriate.
Reporter | ||
Comment 2•17 years ago
|
||
All file types (SVG, html) in the project are in UTF-16. All javascripts are in iso-8859-1. It is no problem to use the javascripts from inside the html files but only from inside the SVG files.
Comment 3•17 years ago
|
||
Are they xhtml or html. It's different parsers in mozilla. Could you try an xhtml file please?
Reporter | ||
Comment 4•17 years ago
|
||
The html files are html not xhtml, but with this files i do not have problems. The SVG files are xml files. With this xml files i have the problem.
Comment 5•17 years ago
|
||
Could you convert try converting and serving one of your html files as xhtml so it is an xml file and confirm that that does not work please?
Reporter | ||
Comment 6•17 years ago
|
||
if using index.html or index.svg then there are javascript errors. Using viewboxtileUTF.js instead of viewboxtile.js solve the problem
Reporter | ||
Comment 7•17 years ago
|
||
Robert sorry but i did not understand why i shall change my html file into xhtml, because the error is in the SVG file not in the html.
I have attached an example, where you can see the problem.
If you start index.html in FF you will get two errors because viewboxtile.js (iso-8859-1) could not be readed from inside map.svg (UTF-16). If you use viewboxtileUTF.js (UTF-16) instead you do not have this errors. The same thing, when you use index.svg. This example only use one svg file (UTF-16) and some js files (iso-8859-1).
If you use this example in Opera or IE then you have no errors
Comment 8•17 years ago
|
||
> Created an attachment (id=296512) [details]
> example which shows the problem
>
> if using index.html or index.svg then there are javascript errors. Using
> viewboxtileUTF.js instead of viewboxtile.js solve the problem
>
Are you now saying you get the same error with html files as svg files. In comment 4 you seemed to imply that html files worked.
Comment 9•17 years ago
|
||
(In reply to comment #7)
> Robert sorry but i did not understand why i shall change my html file into
> xhtml, because the error is in the SVG file not in the html.
I'm trying to get you to determine whether this issue affects SVG only or SVG and XHTML or SVG and XHTML and HTML. Knowing that will make it more likely this bug gets fixed.
You now seem to be saying that this is not an SVG specific issue as it affects html files too. Is that correct?
Reporter | ||
Comment 10•17 years ago
|
||
Sorry my english is not the best. You have misunderstood my comment #7. The error is only with javascripts which are referenced in SVG files.
The example index.html is an example where several SVG files are embedded in a html file. Here some javascript files are referenced in index.html (They work fine) one javascript is referenced in map.svg (This javascript did not work). Index.svg is an example which only use SVG. All javascripts are referenced in index.svg (none of these javascripts work).
As i have seen in my project the issue affects SVG not HTML. I have no informations about xhtml.
Comment 11•17 years ago
|
||
Can you investigate xhtml and determine whether it is affected?
Reporter | ||
Comment 12•17 years ago
|
||
I can not convert index.html without code changes into xhtml because some things are not currently compatible with xhtml. But after removing incompatible parts it seems that i can reference and use javascript files (iso-8859-1) inside a xhtml file (UTF-16) without errors. So i would say the issue does not affect xhtml.
Comment 13•17 years ago
|
||
Thanks Armin, your investigation was very helpful in tracking down the problem.
Assignee: nobody → longsonr
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #296532 -
Flags: superreview?(tor)
Attachment #296532 -
Flags: review?(tor)
Comment 14•17 years ago
|
||
While this would make the testcase work, if I read the spec right it seems that svg:script doesn't have a charset attribute.
Comment 15•17 years ago
|
||
Oops. I guess that makes this invalid then. Seems that SVG ought to do that though.
Updated•17 years ago
|
Attachment #296532 -
Flags: superreview?(tor)
Attachment #296532 -
Flags: review?(tor)
Comment 16•17 years ago
|
||
(In reply to comment #15)
> Oops. I guess that makes this invalid then.
No, the bug report is still valid. SVG says that unknown attributes should be ignored, so specifying the charset attribute should have no effect.
> Seems that SVG ought to do that though.
I agree. <svg:script> should have a @charset. I have raised a bug report in our own bug tracker. [ http://www.w3.org/Bugs/Public/show_bug.cgi?id=5362 ]
Comment 17•17 years ago
|
||
oops... spoke too soon. @charset is probably best left out. See SVG bug #5362.
Bug is still valid, though.
Comment 18•17 years ago
|
||
(In reply to comment #16)
>
> No, the bug report is still valid. SVG says that unknown attributes should be
> ignored, so specifying the charset attribute should have no effect.
>
The charset attribute is currently ignored by firefox which is why the testcases in this bug don't work.
Comment 19•17 years ago
|
||
Armin, do you specify a charset in the mime type when you serve the javascript file?
Comment 20•17 years ago
|
||
I think you need to serve the javascript with something like...
Content-Type: text/javascript; charset=iso-8859-1
Reporter | ||
Comment 21•17 years ago
|
||
Robert, this is the line in the svg file
<script xlink:href="viewboxtile.js" type="text/ecmascript"
charset="iso-8859-1"/>
Comment 22•17 years ago
|
||
I'm not talking about the svg file any more Armin. The charset attribute does not exist on script elements in SVG and so is ignored. Apparently the machine serving the javascript must indicate the charset of the file in the http Content-Type of its response.
Reporter | ||
Comment 23•17 years ago
|
||
Robert, this i do not understand. I have the problem only if i work locally. Where can i have a look if my machine indicate the charset in the http Content type of a lcal file?
Reporter | ||
Comment 24•17 years ago
|
||
Forget my comment #23. The problem is locally and on server.
Comment 25•17 years ago
|
||
Local files are an issue. It would be best if you raised this particular concern in http://www.w3.org/Bugs/Public/show_bug.cgi?id=5362
The SVG specification drives our implementation, at the moment we do what it says, if you can get the specification changed our implementation can follow.
Configuring the Content-Type depends on what server you are using Apache, Tomcat or whatever, each has different rules. Perhaps a newsgroups appropriate to the server you are using could answer that question.
Reporter | ||
Comment 26•17 years ago
|
||
Sorry, i do not understand why the www server should be the reaon for this problem. And i see nothing in the SVG specification which prevent running javascripts with a different codepage from inside a svg.
- i have a javascript file (iso-8859-1)
- i call it from inside a html4 file (UTF16): all works fine
- i call it from inside a xhtml file (UTF16): all works fine
- i call it from inside a svg file (UTF16): nothing works
For me this is a bug.
Comment 27•17 years ago
|
||
SVG does allow javascript with a different codepage to the SVG file. At the moment you must do this via specifying a Content-Type in the server.
Read this: http://www.w3.org/TR/SVG11/script.html#ScriptElement
The only attribute a script element has is type. It does NOT have a charset attribute.
html and xhtml script elements on the other hand DO have a charset attribute.
If you want to discuss whether the specification should have a charset attribute you should do so in http://www.w3.org/Bugs/Public/show_bug.cgi?id=5362
Updated•17 years ago
|
Assignee: longsonr → nobody
Status: ASSIGNED → NEW
Reporter | ||
Comment 28•17 years ago
|
||
Robert, ok i think i understand the fact with the charset attribut. I think Doug has already noticed this.
Just Reply your comment #27 in my words:
This mean if i have a SVG (UTF16) then my javascript must be UTF16 too.
But then i do not understand the following example which works well with FF
- i have a javascript file (UTF16)
- i call it from inside a svg file (iso-8859-1): all works fine
As i see the problem only occurs in direction SVG(UTF16) -> javascript(iso-8859-1) not this direction SVG(iso-8859-1) -> javascript(UTF16). And this i do not see in http://www.w3.org/TR/SVG11/script.html#ScriptElement
Comment 29•17 years ago
|
||
(In reply to comment #28)
> Robert, ok i think i understand the fact with the charset attribut. I think
> Doug has already noticed this.
> Just Reply your comment #27 in my words:
> This mean if i have a SVG (UTF16) then my javascript must be UTF16 too.
No, you can have UTF16 svg and iso-8859-1 javascript if you make the http server return a charset in the Content-Type of the http header.
>
> But then i do not understand the following example which works well with FF
> - i have a javascript file (UTF16)
> - i call it from inside a svg file (iso-8859-1): all works fine
>
> As i see the problem only occurs in direction SVG(UTF16) ->
> javascript(iso-8859-1) not this direction SVG(iso-8859-1) ->
> javascript(UTF16). And this i do not see in
> http://www.w3.org/TR/SVG11/script.html#ScriptElement
>
The default encoding is iso-8859-1 so the javascript will not work unless either it has that encoding or you put the Content-Type in the HTTP header. Perhaps you are specifying the SVG content type in some way.
Comment 30•17 years ago
|
||
Your SVG has this <?xml version="1.0" encoding="utf-16" standalone="no"?> to identify its content type which is presumably why it works even though it is not served with a content-type set.
Reporter | ||
Comment 31•17 years ago
|
||
(In reply to comment #29)
> No, you can have UTF16 svg and iso-8859-1 javascript if you make the http
> server return a charset in the Content-Type of the http header.
I did not know a possibilty to define the used charset in a javascript file. I know this for server based scripts such as PHP or ASP but not for javascript.
Comment 32•17 years ago
|
||
You cannot do it in the javascript file itself only the server of the javascript file can do that or as you say it can be done with PHP or ASP also if you wish.
Reporter | ||
Comment 33•17 years ago
|
||
(In reply to comment #30)
> Your SVG has this <?xml version="1.0" encoding="utf-16" standalone="no"?> to
> identify its content type which is presumably why it works even though it is
> not served with a content-type set.
>
These are my settings for my two examples SVG(UTF16) -> javascript(iso-8859-1) and SVG(iso-8859-1) -> javascript(UTF16)
- i have a javascript file (iso-8859-1 file format)
- i call it from inside a svg file (?xml version="1.0" encoding="utf-16" standalone="no"?)
=> nothing works
- i have a javascript file (UTF16 file format)
- i call it from inside a svg file (?xml version="1.0" encoding="iso-8859-1" standalone="no"?)
=> all works fine
Comment 34•17 years ago
|
||
Do you get similar results with html and xhtml if you remove the charset attribute from the <script> element?
Reporter | ||
Comment 35•17 years ago
|
||
I have now tested the following:
- i have a javascript file (utf-16 file format)
- i call it from inside a html file (utf-16 <meta http-equiv="content-type" content="text/html; charset=utf-16" />)
=> <script src="embfiles/variablen.js" language="JavaScript" type="text/javascript""> works
=> <script src="embfiles/variablen.js" language="JavaScript" type="text/javascript" charset="utf-16">works
=> <script src="embfiles/variablen.js" language="JavaScript" type="text/javascript" charset="iso-8859-1"> did not work
Comment 36•16 years ago
|
||
Looks like the SVG working group declined to add a type attribute to the script object so this cannot be made to work within the confines of the SVG specification.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → INVALID
Comment 37•16 years ago
|
||
Doug just reopened http://www.w3.org/Bugs/Public/show_bug.cgi?id=5362 to consider whether the 'charset' attribute would be useful for local content. I'm not sure exactly what the preferred behavior is, but it seems sensible that the attribute should be used if the charset is not otherwise specified.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Comment 38•16 years ago
|
||
I'd assume the working group would clearly specify the exact behavior here, no?
Comment 39•16 years ago
|
||
Well I'm a member of the WG, and we'll try. ;-) I was CC'ing you guys to see if you had any comments on this and how you think it should work so the WG can get it right the first time.
Comment 40•16 years ago
|
||
You could look at what CSS specifies and then modify as needed for your use case, I guess. You could also look at what HTML5 is doing and try to be compatible with that. That might make the most sense.
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•