--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
- Micheil
> --
JavaScript isn't Python. This style just leaks a global symbol
unnecessarily, and provides no benefit.
Do it this way instead:
res.sendBody('абвгдеёжзиклмнопрст ', 'utf8');
Note the lack of "encoding=". If you want to indicate the meaning of
the parameter, you can use a comment.
Thanks!
--i
I think Irfan may have actually just copied that from the node API docs.
This is how it appears there:
> response.sendBody(chunk, encoding="ascii")
(perhaps there's a less confusing way of indicating the intent of an argument?)
Jed Schmidt
Actually, I'm pretty sure that's valid Javascript, as is this:
> console.log( 123, a = 456, a )
Though it might be better to use comments to indicate defaults:
> response.sendBody(chunk, encoding /* ("ascii") */ )
There must be a convention somewhere that has this, maybe in the dojo
codebase? Either way, since it doesn't break anything, I don't see it
as a huge issue.
Jed Schmidt
2009/12/28 Serge in Darkness <bolte...@gmail.com>:
I would call the default to ascii and the obvious documentation's bias against unicode "premature optimization", but the node about statement clearly states that a benefit of node is that "less-than-expert programmers are able to develop fast systems." So I think this was a design choice.
I personally would have preferred siding with default unicode, and explicit ascii for faster code when you know it's safe, but in the end it's really not a big deal either way. Once it bites you, it's easy to fix.