On Fri, 2004-01-16 at 15:35, David Hampton wrote: > 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);
I agree. > > 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. I'll update gnc_quickfill_insert to normalize before storing the string. > 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. Yes, I think there are a number of other places I did this as well. I'll update them all. > There's also a string comparison here that > should probably compare normalized strings. I'll go back through the code and try to find the places where we receive the strings from the gui components and normalize there. Do you think we need to call g_utf8_validate as well, or can we trust Gnome to pass us valid utf-8 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. Yes, that should be newval_len not newval_chars > 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. The problem I was worried about here was languages where a single lowercase character can map to multiple uppercase characters. In German the lowercase letter ß (Eszett), maps to uppercase 'SS'. The byte length could easily be different - I'm not even sure the character length would be the same (I don't know if the 'SS' is two characters or one). > 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. > Yes, cursor_position, start_selection, and end_selection are all from the GtkEditable interface and are in characters, not bytes. Scott
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