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

entities encoding problem of SSR (IE9) #3899

Closed
speedornothing opened this issue Oct 11, 2016 · 1 comment
Closed

entities encoding problem of SSR (IE9) #3899

speedornothing opened this issue Oct 11, 2016 · 1 comment
Labels

Comments

@speedornothing
Copy link

speedornothing commented Oct 11, 2016

Vue.js version

2.0.1

Reproduction Link

https://vue-hn.now.sh/top

Steps to reproduce

open in IE9 browser

What is Expected?

it('basic-rendering-entities-encoding', function(done){
    var renderer = require('vue-server-renderer').createRenderer()

    var Vue = require('vue')
    var app = new Vue({
      template: '<div id="app">汉字 {{chineseDataMsg}} {{testEntity}}</div>',
      data: function(){
        return {
          chineseDataMsg: '测试',
          testEntity: '<script>alert(1);</script>'
        }
      }
    })

    renderer.renderToString(app, function(err, html){
      try{
        html.should.equal('<div id="app" server-rendered="true">汉字 测试 &lt;script&gt;alert(1);&lt;/script&gt;</div>')
      } catch(e){
        done(e)
        return
      }
      done()
    })
  })

What is actually happening?

some entities codes can not be rendered by IE9, the page contains some entities codes like :

&NewLine; Built with Vue&period;js&NewLine; 
@speedornothing
Copy link
Author

speedornothing commented Oct 11, 2016

I changed some codes as following and it works in IE9.

// write(node.raw ? node.text : entities.encodeHTML(String(node.text)), next)
 write(node.raw ? node.text : require('html-entities').AllHtmlEntities.encode(String(node.text)), next)

Are there some problems if we only encodes HTML Entities ( not encode chinese and some special characters ) ?

@LinusBorg LinusBorg changed the title entities encoding problem of SSR entities encoding problem of SSR (IE9) Oct 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants