Bug 784: Keep form_control.default_value in the document charset.
commit5e83337d49ff77a59ec5d5904d6631abb027a49e
authorKalle Olavi Niemitalo <kon@iki.fi>
Sun, 29 Apr 2007 19:01:13 +0000 (29 22:01 +0300)
committerKalle Olavi Niemitalo <Kalle@Astalo.kon.iki.fi>
Sun, 29 Apr 2007 19:01:13 +0000 (29 22:01 +0300)
treeae68a5ade31927a91196ed6fd7dc2e133954420a
parent0df5b7fdf5f819f03f33b5eb972c4880b35904d1
Bug 784: Keep form_control.default_value in the document charset.

Previously, html_special_form_control converted
form_control.default_value to the terminal charset, and init_form_state
then copied the value to form_state.value.  However, when CONFIG_UTF8
is defined and UTF-8 I/O is enabled, form_state.value is supposed to
be in UTF-8, rather than in the terminal charset.

This mismatch could not be conveniently fixed in
html_special_form_control because that does not know which terminal is
being used and whether UTF-8 I/O is enabled there.  Also, constructing
a conversion table from the document charset to form_state.value could
have ruined renderer_context.convert_table, because src/intl/charsets.c
does not support multiple concurrent conversion tables.

So instead, we now keep form_control.default_value in the document
charset, and convert it in the viewer each time it is needed.  Because
the result of the conversion is kept in form_state.value between
incremental renderings, this shouldn't even slow things down too much.

I am not implementing the proper charset conversions for the DOM
defaultValue property yet, because the current code doesn't have
them for other string properties either, and bug 805 is already open
for that.
src/document/forms.h
src/document/html/renderer.c
src/ecmascript/see/form.c
src/ecmascript/spidermonkey/form.c
src/viewer/text/form.c