Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chinese characters #6

Closed
lmm0591 opened this issue May 27, 2014 · 12 comments
Closed

Chinese characters #6

lmm0591 opened this issue May 27, 2014 · 12 comments

Comments

@lmm0591
Copy link

lmm0591 commented May 27, 2014

messy code with Chinese characters in source maps
like this:

    var generator = require('inline-source-map');
    var foo = '' + function foo () {
        var hello = '中文';
        var world = 'world';
        console.log('%s %s', hello, world);
    }

    var gen = generator()
        .addGeneratedMappings('foo.js', foo)
        .addSourceContent('foo.js', foo);

    console.log('inline mapping url:', gen.inlineMappingUrl());



    inline mapping url: //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiIiwic291cmNlcyI6WyJmb28uanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsInNvdXJjZXNDb250ZW50IjpbbnVsbF19

ChineseCharacters


I modified the source code of inline-source-map in
/inline-source-map/index.js

SourceCode

@AnnieCyl
Copy link

@thlorenz
This is the same issue I posted here:
browserify/browserify#753
And if you want a failing test, here it is:
https://github.com/snowman002000/myrepository
Hope that can help.

@thlorenz
Copy link
Owner

Should be fixed with 0.4 due to PR #8.
Please bug the browser-pack maintainer(s) to upgrade.

@terinjokes
Copy link

@thlorenz
Copy link
Owner

@terinjokes thanks, but that's just the dev dependency and is not used when the actual code runs or the package is installed as a dependency.
However tried to update that dev dependency, but then a few tests fail.

Not sure if that is indicative of a real problem with convert-source-map.
You're welcome to submit a PR there that upgrades inline-source-map (and fixes the tests). I'd appreciate it :)

@terinjokes
Copy link

Sorry I overlooked that. I'm not sure the connection between browser-pack
and inline-source-map then.
On Apr 24, 2015 3:16 PM, "Thorsten Lorenz" notifications@github.com wrote:

@terinjokes https://github.com/terinjokes thanks, but that's just the
dev dependency and is not used when the actual code runs.


Reply to this email directly or view it on GitHub
#6 (comment)
.

@thlorenz
Copy link
Owner

browser-pack depends on combine-source-map which depends on inline-source-map.

Should we update the version in there?

@terinjokes
Copy link

And now I think I see how I got to the wrong package while looking up
dependencies earlier. Very similar package names. ;)
On Apr 24, 2015 4:31 PM, "Thorsten Lorenz" notifications@github.com wrote:

browser-pack depends on combine-source-map
https://github.com/substack/browser-pack/blob/master/package.json#L11
which depends on inline-source-map
https://github.com/thlorenz/combine-source-map/blob/master/package.json#L15
.

Should we update the version in there?


Reply to this email directly or view it on GitHub
#6 (comment)
.

@thlorenz
Copy link
Owner

Anything else we need to do here? Otherwise I'd like to close the issue since it's resolved.

@csbun
Copy link

csbun commented Jul 7, 2015

charset should use = instead of :, like this

Generator.prototype.inlineMappingUrl = function () {
  var charset = this.opts.charset || 'utf-8';
  return '//# sourceMappingURL=data:application/json;charset=' + charset + ';base64,' + this.base64Encode();
};

see Data URI scheme - Format

@thlorenz
Copy link
Owner

Is there an actual spec for this?
We shouldn't just follow a Wiki entry to change this.

Alternatively links to the code of different browsers that parses charset would be more useful than a wiki link.

@shootaroo
Copy link
Collaborator

It is RFC 2397, linked from the wiki entry.

   dataurl    := "data:" [ mediatype ] [ ";base64" ] "," data
   mediatype  := [ type "/" subtype ] *( ";" parameter )
   data       := *urlchar
   parameter  := attribute "=" value

shootaroo added a commit that referenced this issue Jul 17, 2015
shootaroo added a commit that referenced this issue Jul 17, 2015
@thlorenz
Copy link
Owner

Fixed via #13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants