xxgreg / mustache

Mustache template Dart library
BSD 2-Clause "Simplified" License
57 stars 59 forks source link

Unicode is not rendered correctly #49

Open felangel opened 3 years ago

felangel commented 3 years ago
test('Unicode', () {
  var output = parse('\u{1F634}\n').renderString({});
  expect(output, equals('\u{1F634}\n'));
});

The above test fails with the following error:

Expected: '😴\n'
            ''
  Actual: '😴\n'
            '😴\n'
            ''
   Which: is different. Both strings start the same, but the actual value also has the following trailing characters: 😴\n

package:test_api              expect
test/mustache_test.dart 41:7  main.<fn>.<fn>
felangel commented 3 years ago

@xxgreg @jonahwilliams this issue is a blocker for me. I believe I have a fix but this repo and https://github.com/jonahwilliams/mustache don't appear to be very active. I really don't want to fork and republish yet again so can either of you help get a fix for this merged and published? Thanks! 🙏

xxgreg commented 3 years ago

Pinged you privately with a possible solution.

mtwichel commented 3 years ago

@xxgreg @felangel I'm facing a similar issue I believe and wonder if a similar solution could help.

test('Less than', () {
    var output = Template('{{val}}').renderString({'val': '<'});

    expect(output, '<');
  });

fails with the error:

Output for Less than
Expected: '<'
  Actual: '&lt;'
   Which: is different.
          Expected: <
            Actual: &lt;
                    ^
           Differ at offset 0

package:test_api                                   expect
test/src/generators/dart_generator_test.dart 91:5  main.<fn>

Thanks! 🙏

felangel commented 3 years ago

@mtwichel yeah I think it's the same root cause 👍 @xxgreg can you please add me as a publisher/contributor? I'd love to open a PR with a fix and publish a new release 👍

mzdm commented 3 years ago

@mtwichel yeah I think it's the same root cause 👍 @xxgreg can you please add me as a publisher/contributor? I'd love to open a PR with a fix and publish a new release 👍

would be great to push this along with null safety

@xxgreg @jonahwilliams this issue is a blocker for me. I believe I have a fix but this repo and https://github.com/jonahwilliams/mustache don't appear to be very active. I really don't want to fork and republish yet again so can either of you help get a fix for this merged and published? Thanks! 🙏

this one has at least null safety now 👍