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

Sometimes convert result will be \uXXXX. #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

soulteary
Copy link

Hi, there're more and more template engine, some template engine may cause the result contain "\uxxxx", if someone use the gulp-native2ascii around the template engine render action, it doesn't work possibility.

eg:

.pipe(N2A({reverse: false}))
.pipe(TemplateEngine.render())
.pipe(N2A({reverse: true}))

:D

@we11adam
Copy link
Owner

Hello, can you please include some test cases in your pull request so that I can merge the changes altogether? Thanks.

@soulteary
Copy link
Author

@adamme you're welcome, i'll add some test cases later.

thank you for response.

@soulteary
Copy link
Author

@adamme sorry for late, review plz, :D

return unescape(str.split('\\').join('%'));
if(str.indexOf('\\\\u')>-1){
// fix err js minify string
return ascii2native.call(null, str.replace(/\\(\\u(\w+){4})/g, function (all, key) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There're some template engine will render "\u1234" -> "\u1234", so it seems to restore the string one by one.

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

Successfully merging this pull request may close these issues.

2 participants