04-18-2010
- don't modify any system headers unless you know what you're doing
- even if you do, the changes won't show until you recompile the C library (and maybe the kernel), where the sizes of the datatypes are used.
- if you want multibyte characters, use the wchar_t type and associated functions
10 More Discussions You Might Find Interesting
1. Programming
hello,
i have a problem with strlen. I have written this:
for(y=13,z=0; cInBuf!=' ';y++)
{
cBuf=cInBuf;
z++;
}
len = strlen(cBuf);
out=len/2;
fprintf(outfile,"F%i",out);
If strlen is e.g. 22, it write F22. I want to write F2F2.
How can i do this?... (5 Replies)
Discussion started by: ACeD
5 Replies
2. Shell Programming and Scripting
Hello,
Just a little problem with the ksh function : strlen
I want to use this function in this little ksh program :
while read line ; do
TOTO=$line
TOTONB=strlen($TOTO)
echo $TOTONB (3 Replies)
Discussion started by: steiner
3 Replies
3. Shell Programming and Scripting
Collegues
I tried to manipulate a UTF 8 data using the following script.
cat $1 | sed 's/ലായി$/ലായി LAYI/g' | sed 's/ുടെ/ുടെ UTE/g' | sed 's/യില്*/യില്* YIL/g'
But it says that cnot exicute binary file. Any solution.
Jaganadh.
Linguist (1 Reply)
Discussion started by: jaganadh
1 Replies
4. Programming
In a declaration, I have:
const char comment_begin = "<!--";
const char comment_end = "-->";
const int comment_begin_len = strlen(comment_begin);
const int comment_end_len = strlen(comment_end);
When I compile, I get the warnings:
emhttpc.c:64: warning: initializer element is not... (10 Replies)
Discussion started by: cleopard
10 Replies
5. Programming
I have been getting some flack recently for my use of strlen() and strnlen(). Honestly I have always just taken their functionality for granted as being the easiest way of getting the length of a string. Is it really so much better to do pointer arithmetic? What am I gaining besides more... (3 Replies)
Discussion started by: jjinno
3 Replies
6. UNIX for Advanced & Expert Users
We just installed icu for UTF-8 compliance on our AIX 5.3 system. While usuing vi on some files we get the following error:
ex: 0602-169 Incomplete or invalid multibyte character encountere
yte character encountered, conversion failed.ex: 0602-169 Incomplete or invalidb
ractersultibyte... (0 Replies)
Discussion started by: jlacasci
0 Replies
7. UNIX for Dummies Questions & Answers
I need to use sort, uniq, grep, wc,... and the like to work with lists of words in UTF-8 (the "words" being phonetic transcriptions using the IPA). I have been using Google a lot and I even found at least one previous post on this topic, but it didn't help.
I tried following the instructions... (2 Replies)
Discussion started by: mregine
2 Replies
8. Linux
Hi,
I have tried to convert a UTF-8 file to windows UTF-16 format file as below from unix machine
unix2dos < testing.txt | iconv -f UTF-8 -t UTF-16 > out.txt
and i am getting some chinese characters as below which l opened the converted file on windows machine.
LANG=en_US.UTF-8... (3 Replies)
Discussion started by: phanidhar6039
3 Replies
9. Programming
Hello,
This function was copied into my code, which was compiled without error/warning, but when executed there is always Segmentation fault at the end after the output (which seems correct!):
void get_hashes(unsigned int hash, unsigned char *in)
{
unsigned char *str = in;
int pos =... (7 Replies)
Discussion started by: yifangt
7 Replies
10. Shell Programming and Scripting
greetings,
pretty new to php and i think i might be missing some fundamental limitation of isset. i have two php scripts below that are executed by crond, one using --host X and one that does not. and below that are three different attempts at generating a command line that will be executed. the... (8 Replies)
Discussion started by: crimso
8 Replies
LEARN ABOUT OSX
multibyte
MULTIBYTE(3) BSD Library Functions Manual MULTIBYTE(3)
NAME
multibyte -- multibyte and wide character manipulation functions
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <limits.h>
#include <stdlib.h>
#include <wchar.h>
DESCRIPTION
The basic elements of some written natural languages, such as Chinese, cannot be represented uniquely with single C chars. The C standard
supports two different ways of dealing with extended natural language encodings: wide characters and multibyte characters. Wide characters
are an internal representation which allows each basic element to map to a single object of type wchar_t. Multibyte characters are used for
input and output and code each basic element as a sequence of C chars. Individual basic elements may map into one or more (up to MB_LEN_MAX)
bytes in a multibyte character.
The current locale (setlocale(3)) governs the interpretation of wide and multibyte characters. The locale category LC_CTYPE specifically
controls this interpretation. The wchar_t type is wide enough to hold the largest value in the wide character representations for all
locales.
Multibyte strings may contain 'shift' indicators to switch to and from particular modes within the given representation. If explicit bytes
are used to signal shifting, these are not recognized as separate characters but are lumped with a neighboring character. There is always a
distinguished 'initial' shift state. Some functions (e.g., mblen(3), mbtowc(3) and wctomb(3)) maintain static shift state internally,
whereas others store it in an mbstate_t object passed by the caller. Shift states are undefined after a call to setlocale(3) with the
LC_CTYPE or LC_ALL categories.
For convenience in processing, the wide character with value 0 (the null wide character) is recognized as the wide character string termina-
tor, and the character with value 0 (the null byte) is recognized as the multibyte character string terminator. Null bytes are not permitted
within multibyte characters.
The C library provides the following functions for dealing with multibyte characters:
Function Description
mblen(3) get number of bytes in a character
mbrlen(3) get number of bytes in a character (restartable)
mbrtowc(3) convert a character to a wide-character code (restartable)
mbsrtowcs(3) convert a character string to a wide-character string (restartable)
mbstowcs(3) convert a character string to a wide-character string
mbtowc(3) convert a character to a wide-character code
wcrtomb(3) convert a wide-character code to a character (restartable)
wcstombs(3) convert a wide-character string to a character string
wcsrtombs(3) convert a wide-character string to a character string (restartable)
wctomb(3) convert a wide-character code to a character
SEE ALSO
mklocale(1), setlocale(3), stdio(3), big5(5), euc(5), gb18030(5), gb2312(5), gbk(5), mskanji(5), utf8(5)
STANDARDS
These functions conform to ISO/IEC 9899:1999 (``ISO C99'').
BSD
April 8, 2004 BSD