static-void / gcalsync2-0

Automatically exported from code.google.com/p/gcalsync2-0
0 stars 0 forks source link

Is this correct? #51

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
From GCalEvent.java, line 174

                        /* Encode special characters in UTF-8. For example, the
                        character '�' (ASCII code 0xE4) is represented in
UTF-8
                        as two bytes: 0xC3 0xA4, where 0xC3 is the ASCII code
                        for '�' and 0xA4 is the original character's
ASCII code
                        adjusted by '@' (ASCII code 0x40). */
            if (c[i] >= '�' && c[i] <= '�') {
                sb.append('�');
                sb.append(c[i]);
            } else if (c[i] >= '�' && c[i] <= '�') {
                sb.append('�');
                sb.append((char)(c[i] - '@'));
            } else {
                sb.append(c[i]);
            }

The "if" and "else if" looks the same..

Original issue reported on code.google.com by fore...@gmail.com on 19 Feb 2008 at 4:03

GoogleCodeExporter commented 9 years ago
This is not bug. Your text editor shows unicode symbols as equal.

Actually this code should be read as:
            if (c[i] >= '\u00a1'/*'¡'*/ && c[i] <= '\u00bf'/*'¿'*/) {
                sb.append('\u00c2'/*'Â'*/);
                sb.append(c[i]);
            } else if (c[i] >= '\u00c0'/*'À'*/ && c[i] <= '\u00bf'/*'ÿ'*/) {
                sb.append('\u00c3'/*'Ã'*/);
                sb.append((char)(c[i] - 0x40/*'@'*/));
            } else {
                sb.append(c[i]);
            }

This method is deprecated begining from the next release (2.0.6).

Original comment by ydan...@gmail.com on 21 Feb 2008 at 3:29