discuss-gnustep
[Top][All Lists]
Advanced

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

Re: NSString lowercaseString


From: Sebastian Reitenbach
Subject: Re: NSString lowercaseString
Date: Wed, 01 Aug 2012 18:00:37 +0200
User-agent: SOGoMail 1.3.17

On Wednesday, August 1, 2012 16:42 CEST, David Chisnall <theraven@sucs.org> 
wrote:

> On 1 Aug 2012, at 12:20, Sebastian Reitenbach wrote:
>
> > I had to change it slightly to compile with gcc, results are still 
> > different:
>
> This is expected, and is due to the gcc misfeature that was the subject of a 
> long thread a while ago: GCC will emit UTF-8 literals for Objective-C strings 
> (as you'd expect), but will interpret the input text according to your locale 
> at the time of compilation.

Doh! So I should run

LC_CTYPE='de_DE.UTF-8' gcc ....'
and it will change things?

Either I understood wrong, or it doesn't seem to change much:

On Linux:
sre@sre:~> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/4.5/lto-wrapper
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info 
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64 
--enable-languages=c,c++,objc,fortran,obj-c++,java,ada 
--enable-checking=release --with-gxx-include-dir=/usr/include/c++/4.5 
--enable-ssp --disable-libssp --disable-plugin 
--with-bugurl=http://bugs.opensuse.org/ --with-pkgversion='SUSE Linux' 
--disable-libgcj --disable-libmudflap --with-slibdir=/lib64 --with-system-zlib 
--enable-__cxa_atexit --enable-libstdcxx-allocator=new --disable-libstdcxx-pch 
--enable-version-specific-runtime-libs --program-suffix=-4.5 
--enable-linux-futex --without-system-libunwind --enable-gold 
--with-plugin-ld=/usr/bin/gold --with-arch-32=i586 --with-tune=generic 
--build=x86_64-suse-linux
Thread model: posix
gcc version 4.5.0 20100604 [gcc-4_5-branch revision 160292] (SUSE Linux)
sre@sre:~> LC_CTYPE='en_EN.UTF-8' gcc -fgnu-runtime 
-fconstant-string-class=NSConstantString -I/usr/local/include -L/usr/local/lib 
-l gnustep-base lowercase2.m -o lowercase2 -fexceptions -fobjc-exceptions 
-D_NATIVE_OBJC_EXCEPTIONS
sre@sre:~> LC_CTYPE='de_DE.UTF-8' ./lowercase2
2012-08-01 17:53:49.772 lowercase2[26546] Lowercase: töÃst
2012-08-01 17:53:49.774 lowercase2[26546] Lowercase: töÃst
2012-08-01 17:53:49.774 lowercase2[26546] t 116
2012-08-01 17:53:49.774 lowercase2[26546] Ã 195
2012-08-01 17:53:49.774 lowercase2[26546] ¶ 182
2012-08-01 17:53:49.774 lowercase2[26546] Ã 195
2012-08-01 17:53:49.774 lowercase2[26546]  150
2012-08-01 17:53:49.774 lowercase2[26546] s 115
2012-08-01 17:53:49.774 lowercase2[26546] t 116
sre@sre:~> LC_CTYPE='en_EN.UTF-8' ./lowercase2
2012-08-01 17:54:00.074 lowercase2[26556] Lowercase: töÖst
2012-08-01 17:54:00.075 lowercase2[26556] Lowercase: töÃst
2012-08-01 17:54:00.075 lowercase2[26556] t 116
2012-08-01 17:54:00.075 lowercase2[26556] � 195
2012-08-01 17:54:00.075 lowercase2[26556] � 182
2012-08-01 17:54:00.075 lowercase2[26556] � 195
2012-08-01 17:54:00.075 lowercase2[26556] � 150
2012-08-01 17:54:00.075 lowercase2[26556] s 115
2012-08-01 17:54:00.075 lowercase2[26556] t 116
sre@sre:~> LC_CTYPE='de_DE.UTF-8' gcc -fgnu-runtime 
-fconstant-string-class=NSConstantString -I/usr/local/include -L/usr/local/lib 
-l gnustep-base lowercase2.m -o lowercase2 -fexceptions -fobjc-exceptions 
-D_NATIVE_OBJC_EXCEPTIONS
sre@sre:~> LC_CTYPE='de_DE.UTF-8' ./lowercase2
2012-08-01 17:54:38.201 lowercase2[26581] Lowercase: töÃst
2012-08-01 17:54:38.204 lowercase2[26581] Lowercase: töÃst
2012-08-01 17:54:38.204 lowercase2[26581] t 116
2012-08-01 17:54:38.204 lowercase2[26581] Ã 195
2012-08-01 17:54:38.204 lowercase2[26581] ¶ 182
2012-08-01 17:54:38.204 lowercase2[26581] Ã 195
2012-08-01 17:54:38.204 lowercase2[26581]  150
2012-08-01 17:54:38.204 lowercase2[26581] s 115
2012-08-01 17:54:38.204 lowercase2[26581] t 116
sre@sre:~> LC_CTYPE='en_EN.UTF-8' ./lowercase2
2012-08-01 17:54:31.822 lowercase2[26577] Lowercase: töÖst
2012-08-01 17:54:31.823 lowercase2[26577] Lowercase: töÃst
2012-08-01 17:54:31.823 lowercase2[26577] t 116
2012-08-01 17:54:31.823 lowercase2[26577] � 195
2012-08-01 17:54:31.823 lowercase2[26577] � 182
2012-08-01 17:54:31.823 lowercase2[26577] � 195
2012-08-01 17:54:31.823 lowercase2[26577] � 150
2012-08-01 17:54:31.823 lowercase2[26577] s 115
2012-08-01 17:54:31.823 lowercase2[26577] t 116

On OpenBSD:
$ gcc -v
Reading specs from /usr/lib/gcc-lib/amd64-unknown-openbsd5.1/4.2.1/specs
Target: amd64-unknown-openbsd5.1
Configured with: OpenBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.1 20070719
$ LC_CTYPE='de_DE.UTF-8' gcc -fgnu-runtime 
-fconstant-string-class=NSConstantString -I/usr/local/include -L/usr/local/lib 
-l gnustep-base lowercase2.m -o lowercase2
/usr/local/lib/libgnustep-base.so.5.0: warning: sprintf() is often misused, 
please use snprintf()
/usr/lib/libobjc.so.5.0: warning: strcpy() is almost always misused, please use 
strlcpy()
/usr/local/lib/libgmp.so.9.0: warning: vsprintf() is often misused, please use 
vsnprintf()
/usr/local/lib/libgnutls.so.18.2: warning: strcat() is almost always misused, 
please use strlcat()
/usr/local/lib/libgcrypt.so.18.0: warning: stpcpy() is dangerous GNU crap; 
don't use it
$ LC_CTYPE='de_DE.UTF-8' ./lowercase2
2012-08-01 17:57:11.489 lowercase2[30017] Lowercase: tööst
2012-08-01 17:57:11.496 lowercase2[30017] Lowercase: tööst
2012-08-01 17:57:11.496 lowercase2[30017] t 116
2012-08-01 17:57:11.496 lowercase2[30017] ö 246
2012-08-01 17:57:11.496 lowercase2[30017] ö 246
2012-08-01 17:57:11.496 lowercase2[30017] s 115
2012-08-01 17:57:11.496 lowercase2[30017] t 116
$ LC_CTYPE='en_EN.UTF-8' ./lowercase2
2012-08-01 17:57:18.012 lowercase2[14198] Lowercase: t��st
2012-08-01 17:57:18.014 lowercase2[14198] Lowercase: tööst
2012-08-01 17:57:18.014 lowercase2[14198] t 116
2012-08-01 17:57:18.014 lowercase2[14198] � 246
2012-08-01 17:57:18.014 lowercase2[14198] � 246
2012-08-01 17:57:18.014 lowercase2[14198] s 115
2012-08-01 17:57:18.014 lowercase2[14198] t 116
$ LC_CTYPE='en_EN.UTF-8' gcc -fgnu-runtime 
-fconstant-string-class=NSConstantString -I/usr/local/include -L/usr/local/lib 
-l gnustep-base lowercase2.m -o lowercase2
/usr/local/lib/libgnustep-base.so.5.0: warning: sprintf() is often misused, 
please use snprintf()
/usr/lib/libobjc.so.5.0: warning: strcpy() is almost always misused, please use 
strlcpy()
/usr/local/lib/libgmp.so.9.0: warning: vsprintf() is often misused, please use 
vsnprintf()
/usr/local/lib/libgnutls.so.18.2: warning: strcat() is almost always misused, 
please use strlcat()
/usr/local/lib/libgcrypt.so.18.0: warning: stpcpy() is dangerous GNU crap; 
don't use it
$ LC_CTYPE='de_DE.UTF-8' ./lowercase2                                           
                                                        
2012-08-01 17:57:33.942 lowercase2[21547] Lowercase: tööst
2012-08-01 17:57:33.944 lowercase2[21547] Lowercase: tööst
2012-08-01 17:57:33.944 lowercase2[21547] t 116
2012-08-01 17:57:33.944 lowercase2[21547] ö 246
2012-08-01 17:57:33.944 lowercase2[21547] ö 246
2012-08-01 17:57:33.944 lowercase2[21547] s 115
2012-08-01 17:57:33.944 lowercase2[21547] t 116
$ LC_CTYPE='en_EN.UTF-8' ./lowercase2                                           
                                                        
2012-08-01 17:57:38.476 lowercase2[3228] Lowercase: t��st
2012-08-01 17:57:38.478 lowercase2[3228] Lowercase: tööst
2012-08-01 17:57:38.478 lowercase2[3228] t 116
2012-08-01 17:57:38.478 lowercase2[3228] � 246
2012-08-01 17:57:38.478 lowercase2[3228] � 246
2012-08-01 17:57:38.478 lowercase2[3228] s 115
2012-08-01 17:57:38.478 lowercase2[3228] t 116


Sebastian

>
> David
>
> -- Sent from my STANTEC-ZEBRA
>







reply via email to

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