Skip to content

Commit

Permalink
Merge pull request #276 from w3c/odinho/sse-utf8
Browse files Browse the repository at this point in the history
eventsource: Check that charset is ignored and UTF-8 is decoded.
  • Loading branch information
jgraham committed Aug 15, 2013
2 parents d5a18ec + 88c560d commit d26a0b3
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions eventsource/format-utf-8.htm
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,16 @@
<body>
<div id="log"></div>
<script>
var test = async_test()
test.step(function() {
var source = new EventSource("resources/message.php?mime=text/event-stream;charset=windows-1252&message=data%3A%E2%80%A6")
source.onmessage = function(e) {
test.step(function() {
assert_unreached()
this.close()
}, this)
test.done()
}
source.onerror = function() {
test.step(function() { assert_equals(this.readyState, this.CLOSED) }, this)
test.done()
}
async_test().step(function() {
var source = new EventSource("resources/message.php?mime=text/event-stream;charset=windows-1252&message=data%3Aok%E2%80%A6")
source.onmessage = this.step_func(function(e) {
assert_equals('ok…', e.data, 'decoded data')
source.close()
this.done()
})
source.onerror = this.step_func(function() {
assert_unreached("Got error event")
})
})
</script>
</body>
Expand Down

0 comments on commit d26a0b3

Please sign in to comment.