Code Monkey home page Code Monkey logo

Comments (4)

lautis avatar lautis commented on June 5, 2024

Could you send an example file? What JS runtime are you using?

I'm assuming that this is some kind of Byte Order Mark, but as I don't have access to Visual Studio it's a bit hard to debug.
You could try to save the file as "UTF-8 without signature".

from uglifier.

ultimatedelman avatar ultimatedelman commented on June 5, 2024

@lautis wow! thank you so much. that is indeed the issue. is there a way to fix this in code without having to go the extra step defining saving with encoding? some of my users may not know to do this...

from uglifier.

lautis avatar lautis commented on June 5, 2024

Yes, something can be done. It depends on how you are calling Uglifier, Ruby version and probably even on your JavaScript runtime.

On Ruby 1.9.2 you can open/read file with File.open('file.txt', "r:bom|utf-8").read and it should strip BOM. It also seems that using Node.JS as JavaScript runtime does work, but that may not be true on Windows.

I'll try to replicate this issue next week when I can access our office Windows testing PC. Stealing some BOM stripping code from Sprockets should solve this. https://github.com/sstephenson/sprockets/blob/master/lib/sprockets/utils.rb

from uglifier.

ultimatedelman avatar ultimatedelman commented on June 5, 2024

@lautis you are my personal savior. thank you!

from uglifier.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.