bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7282: 23.2; [PATCH] Improve text composition by Input Methods on Mac


From: YAMAMOTO Mitsuharu
Subject: bug#7282: 23.2; [PATCH] Improve text composition by Input Methods on MacOSX.
Date: Thu, 28 Oct 2010 15:35:38 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Thu, 28 Oct 2010 15:15:54 +0900, Keitaro Miyazaki 
>>>>> <keitaro.miyazaki@gmail.com> said:

> Do you mean that there are some cases that the number of characters
> in a string, in other words, the length of a string, is different
> from the one counted by NSString to the one counted by Emacs?

> If so, could you show me any example of these cases?

I mentioned "non-BMP characters" in the previous reply.

(mapcar 'length (list (string #xffff) (string #x10000)))

=> (1 1)

#import <Cocoa/Cocoa.h>
#include <stdio.h>

main()
{
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
  const char str1[] = {0xef, 0xbf, 0xbf, '\0'}; // U+ffff in UTF-8
  const char str2[] = {0xf0, 0x90, 0x80, 0x80, '\0'}; // U+10000 in UTF-8
  NSString *string1 = [NSString stringWithUTF8String:str1];
  NSString *string2 = [NSString stringWithUTF8String:str2];

  printf ("%ld %ld\n", [string1 length], [string2 length]);
  [pool release];
}

=> 1 2

                                     YAMAMOTO Mitsuharu
                                mituharu@math.s.chiba-u.ac.jp





reply via email to

[Prev in Thread] Current Thread [Next in Thread]