On Tue, 2004-01-06 at 17:10, Scott Oonk wrote: 
> Hello,
> 
> This is a first attempt at updating gnucash to work with utf-8.  I
> started with the register code - I haven't looked at the xml file or
> anything else yet.  There are still a few things to clean up in the
> register but I wanted to put this out here now to see if anyone had any
> comments on the way I was going about this.

Looks good to me.  Couple of comments below.  These are for discussion,
as utf-8 is new to me as well.

David


1) The code fragment:

  key = g_unichar_islower (key_char_uc)
    ? g_unichar_toupper (key_char_uc)
    : key_char_uc;

doesn't seem necessary given the description of g_unichar_toupper.

g_unichar_toupper returns the result of converting c to uppercase. If c
is not an lowercase or titlecase character, or has no upper case
equivalent c is returned unchanged.

This code fragment could just be:

  key = g_unichar_toupper (key_char_uc);

2) In quickfill_insert_recursive you've left a strncmp() of two utf-8
strings.  This should probably be a comparison of the two strings after
they are passed to g_utf8_normalize.  Actually, quickfill should
probably store only normalized strings.

3) Is the insert_text argument to gnc_xfer_description_insert_cb a utf-8
string?  For the "Copy old text after insert position", can you just use
g_string_append(new_text_gs, c)?  That should add all the remaining
characters to the string.  There's also a string comparison here that
should probably compare normalized strings.

4) In gnc_quickfill_cell_modify_verify() where you have a comment about
something being non-safe, I think there's a bug.  You're passing the
number of characters to g_strndup() instead of the number of bytes.  If
you know that the byte count includes only whole utf characters, you
could just use it here.  Its also utf-8 safe I think.  I think utf-8
guarantees that the null character isn't used anywhere in the string
except as a terminator.

5) Are the arguments to gnc_formula_cell_direct_update in terms of
characters or bytes?  Your changes assume its characters, which is I
think the right answer.

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
gnucash-devel mailing list
[EMAIL PROTECTED]
http://www.gnucash.org/cgi-bin/mailman/listinfo/gnucash-devel

Reply via email to