mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.2 KiB
30 lines
1.2 KiB
--- !ditz.rubyforge.org,2008-03-06/issue
|
|
title: allow writing single character values to buffer objects (e.g. buf[123] = 'x')
|
|
desc: |-
|
|
Currently the string value will be coerced to a number which leads to
|
|
quite unexpected behavior. For instance, buf[123] = 'x' will assign 0x00
|
|
to the buffer, and buf[123] = '9' will assign 0x09 (not 0x39) to the buffer.
|
|
type: :task
|
|
component: duk
|
|
release: v0.11
|
|
reporter: Sami Vaarala <sami.vaarala@iki.fi>
|
|
status: :unstarted
|
|
disposition:
|
|
creation_time: 2014-03-27 22:28:47.206755 Z
|
|
references: []
|
|
|
|
id: b557ffd92f8ffe1774a403e138a1237599be230d
|
|
log_events:
|
|
- - 2014-03-27 22:28:47.342500 Z
|
|
- Sami Vaarala <sami.vaarala@iki.fi>
|
|
- created
|
|
- ""
|
|
- - 2014-05-07 21:02:24.611888 Z
|
|
- Sami Vaarala <sami.vaarala@iki.fi>
|
|
- commented
|
|
- |-
|
|
Taking the byte value of the first byte of a string would actually work quite
|
|
well. Because strings are guaranteed to have NUL terminator, empty strings
|
|
would cause a zero to be written which is reasonably intuitive. For non-ASCII
|
|
characters the first byte of the extended UTF-8 representation would be used:
|
|
not great (better might be codepoint & 0xff) but probably good enough.
|
|
|