The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Invisible Characters In Template Cache

When I cache the url where I get my checkout template from, it sometimes contains special characters that are invisible in most encodings. It causes problem with the way the html is parsed, and breaks a lot of the JavaScript or CSS that is used on the template. I usually just do a find and replace after the template is pulled down, then I resave it.

These characters are not in the original source, so the problem is somewhere with automagicache. Here is the special character I'm talking about (between quotes. Not sure if it'll go through) ""

It is zero width. I have a view of it in a hex editor. (Start of second line)
  • fc_adamfc_adam FoxyCart Team

    Sorry to hear you're having trouble with automagicache and invisible characters appearing there. Would it be possible to confirm with you your store so we can do some testing on our side? If you'd prefer to keep it secret, feel free to whisper that by checking the "whisper" checkbox when replying and enter my username in the text input that appears.
  • brettbrett FoxyCart Team
    edited June 2017
    Hi @Raul.
    We've dug a little and it looks like the invisible character is part of your file. It's hard to see, as if you save it from a browser it doesn't show. But if you use Burp to see the raw request and response, you'll see this in the response (if you copy/paste out of Burp to an editor; it doesn't show visibly in the response):
    Content-Type: text/css
    Content-Length: 7758

    /*! normalize.css v3.0.3 | MIT License | */

    * 1. Set default font family to sans-serif.
    * 2. Prevent iOS and IE text size adjust after device orientation change,
    * without disabling user zoom.

    Compare that to
    Content-Type: text/css
    Connection: keep-alive
    Last-Modified: Tue, 28 Jul 2015 22:47:56 GMT
    ETag: W/"0831cba6a670e405168b84aa20798347"
    Server: NetDNA-cache/2.2
    Expires: Sun, 03 Jun 2018 20:21:08 GMT
    Cache-Control: max-age=31104000
    Vary: Accept-Encoding
    Access-Control-Allow-Origin: *
    X-Hello-Human: Say hello back! @getBootstrapCDN on Twitter
    X-Cache: HIT
    Content-Length: 26711

    * Font Awesome 4.4.0 by @davegandy - - @fontawesome
    * License - (Font: SIL OFL 1.1, CSS: MIT License)

    I think we've only seen this happen once before, so I'm not sure how those characters are getting into your file in the first place, but I'm pretty sure our caching script isn't inserting them out of nowhere. If you delete/re-save the file or try a different text editor, then re-cache, I'm guessing the issue might disappear?
  • RaulRaul Member
    I googled the "" character and it is a byte order mark. Apparently this is inserted at the start of a stream to denote unicode. The file was probably processed in some way before we got it, and it left the BOM in there.

    I had to download the file, edit it in a hex editor to delete the mark, then reupload it. I will do this for all of the other files too.

    Thanks for the help. I didn't think it was the file itself, since no editor or viewer allowed me to see the character even with the raw request. We also use the same files on other sites which had no problems. I'm curious about the Burp tool you're using. I could not find anything online other than the burp suite, but it looks a bit complicated to use.
Sign In or Register to comment.