Skybound

Skybound Support Forum

Add New Post
  1. harkenman
    Member

    Hello,

    I'm mostly using files that are encoded in UTF-8 without BOM. Most current OpenSource projects like Joomla, SurgarCRM, Drupal to name only three save files in UTF-8.

    If I load stylesheets that are encoded in UTF-8 all special chars like German Umlauts get garbled.
    Sample: #Author: Jürgen Hörmann
    If I save those files it gets worse on every reload. each garbled character itself will be garbled into two more chars and so on. Soon I have multiple lines filled up with character garbage.

    What can I do?

    Posted 6 months ago #
  2. Skybound_Paul
    Key Master

    Where are you using the umlauts?
    background-image URLs?
    selectors?

    Posted 6 months ago #
  3. harkenman
    Member

    In comments only.

    Posted 6 months ago #
  4. Skybound_Paul
    Key Master

    Stylizer uses UTF-8 by default, this should be working. Is the site public? Can I navigate to it? If you don't want to post a link to it, send it in to support at skybound dot ca.

    And to clear out the obvious, can you not just add a byte order mark to the file?

    Posted 6 months ago #
  5. harkenman
    Member

    I created a testfile: http://test.juergenhoermann.de/test.html

    What is weird is the fact, loading this file from disk Stylizer will properly handle the UTF-8 characters while loading over HTTP it will garble these characters.

    My observations are:
    Apache does not send the Content-Type: header with the encoding information by default. HTML documents will define their content type either via meta http-equiv="content-type" or <?xml version="1.0" encoding="ISO-8859-1"?>
    If I load my testpage in Firefox and display the source I can click on the link to the stylesheet and it displays correct.
    But if I directly call the test stylesheet URL in the Browser (clear your cache!) Firefox assumes the wrong default charset (ISO-8859-1). This is because Firefox will apply the encoding of the HTML file to its descendant files like CSS and javascript that are linked in the HTML header.

    I think here is the point Stylizer fails. It does not apply the encoding from the HTML file to the CSS file.
    The next problem is that Stylizer ignores CSS character encoding declarations:
    http://www.w3.org/International/questions/qa-css-charset.en.php

    That would be a workaround for me, but I'd prefer Stylizer would handle character encodings like Firefox and if present honour the encoding declaration.

    Posted 6 months ago #
  6. Skybound_Paul
    Key Master

    At this point, what you're requesting isn't technically feasible, as there are hundreds of encodings that we would have to individually support. Yes, Firefox supports them, but in Stylizer, the CSS download process happens externally from the browser.

    Posted 6 months ago #
  7. harkenman
    Member

    I'm not asking to support dozens of encodings. I'm asking that Stylizer handles UTF-8 properly. Currently Stylizer treats a UTF-8 file as if it were a ISO-8859-1 file.
    You said Stylizer internally uses UTF-8. Why do UTF-8 files get garbled?

    I cannot understand why you can't read the Content-Type property from the HTML file. Stylizer can only open HTML files, so the information of the character encoding should always be available. Stylizer first loads the HTML file and after that fetches the associated CSS files. Right?

    One more thing I want to ask for. How can I configure Stylizer to leave my comments alone? I do not like Stylizer to reformat and trim my comment lines.

    Posted 6 months ago #
  8. Skybound_Paul
    Key Master

    "Stylizer can only open HTML files"
    It opens URLs, CSS files, and HTML files. Most people open URLs.

    I think the solution here is to send the correct encoding in the HTTP header. If you open http://test.juergenhoermann.de/test.css, you'll see that it's coming through as ISO-8859-1. If you open that file directly in Firefox, you'll get the same thing as you get in Stylizer.

    Posted 6 months ago #
  9. harkenman
    Member

    > It opens URLs, CSS files, and HTML files. Most people open URLs.
    Well, a URL is only a resource handle that defines the transmission protocol too. What you receive depends on the file that is referenced by the URL.
    What I was trying to say was: The workflow in Stylizer dictates to open/load a HTML file. You cannot open CSS files from disk or by URL (and edit them). Because Stylizer always loads a HTML file first you could read the proper encoding from the HTML file.

    > I think the solution here is to send the correct encoding in the HTTP header

    AFAIK there is no way to configure Apache to read the encoding from a plain text file. This is why browsers apply the encoding of the HTML to the encoding of Javascript and CSS files.

    > If you open http://test.juergenhoermann.de/test.css, you'll see that it's coming through as ISO-8859-1
    You are wrong here, it comes through as UTF-8. But because Apache does not add the encoding value to the Content-Type: HTTP header your browser defaults to whatever you have set as the default encoding in your browser settings. As you can see this assumption your browser makes is only wrong if you load the css file directly.
    Open http://test.juergenhoermann.de/test.html display the source and klick the link to the CSS. You will see this time the encoding is ok. This is because the Browser will use the encoding the HTML document specified.

    What Stylizer needs to do is load the HTML file. Get the encoding from the HTML and save the value. When loading the CSS apply the encoding saved before to the CSS files.

    Posted 6 months ago #
  10. Skybound_Paul
    Key Master

    > The workflow in Stylizer dictates to open/load a HTML file. You cannot open CSS files from disk or by URL (and edit them). Because Stylizer always loads a HTML file first you could read the proper encoding from the HTML file.

    Actually, if you click on the plus sign beside the style sheet list, you can load a CSS file directly off your hard disk. In fact, if you do that, your style sheet will load properly.

    Additionally, we found that your file wasn't loading properly because of a small bug. We'll be pushing out a release today that will fix it.

    Posted 6 months ago #
  11. harkenman
    Member

    Thank you for the bugfix. I'm glad I did not give in on this topic ;)

    Posted 6 months ago #

Reply

You must log in to post.