02-14-2009
Try functions like 'mbtowc' that are C99 conformant or 'iconv' (POSIX).
Former need correct setting of LC_CTYPE, latter also needs to specify conversion details.
In my case, when I obtained working code with them, I decided to write
my own code for wchar_t / UTF-8 conversion.
9 More Discussions You Might Find Interesting
1. Cybersecurity
Hi! I'm fully aware of that this is not a chat forum,
at least it's not what it's intended to be, but i do not
find any better way of dealing with my problem...
I'm using, well at least right now, a text based webbrowser,
the LYNX actually, for the first time, works pretty well...
Would like... (0 Replies)
Discussion started by: zeus
0 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I am trying to quickly learn Unix because I am going to be using HP-UX soon.
Problem is I can't find download HP-UX.
Does anyone know a Unix OS I can download that is more like HP-UX?
I'm running windows vista at the moment. (3 Replies)
Discussion started by: budz
3 Replies
3. Programming
Hi everybody,
first of all i apologize if my thread's title doesn't make much sense,but i coudn't find a more appropriate name :)
Then i apologize about my question,which probably will sound trivial for you :) :)
I am working on a program which is being tested in Linux but the final target is... (2 Replies)
Discussion started by: Zipi
2 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
i have two functions in my script.
question()
{
num=`ps -e | grep ps | awk -F" " '{print $1}'`
qno=`expr $num % 10`
grade=grade1
cat grade1/$qno
answer ${grade} ${qno}
}
answer()
{
grade=$1
qno=$2
ansno=`wc -l $grade/ans/$qno | cut -d' ' -f1`
j=0
while
do (1 Reply)
Discussion started by: Usha Shastri
1 Replies
5. Shell Programming and Scripting
Hi Guys,
Is there a way to write a recursive function in unix?
Thanks for your help in advance,
Regards,
Magesh. (1 Reply)
Discussion started by: mac4rfree
1 Replies
6. Shell Programming and Scripting
I have a file which contains data as below:
nbk1j7o pageName=/jsp/RMBS/RMBSHome.jsf
nbk1j7o pageName=/jsp/RMBS/RMBSHome.jsf
nbk1j7o pageName=/jsp/RMBS/RMBSHome.jsf
nbk1j7o pageName=/jsp/RMBS/RMBSHome.jsf
nbk1j7o pageName=/jsp/common/index.jsf
nbk1j7o pageName=/jsp/common/index.jsf
nbk1wqe... (6 Replies)
Discussion started by: mohsin.quazi
6 Replies
7. Shell Programming and Scripting
I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line
if
then... (8 Replies)
Discussion started by: saku
8 Replies
8. What is on Your Mind?
Hello.
I have redesigned our "similar threads" for a more "clean style" in both the desktop view and the mobile view for the forum "show thread".
The new design is a simple straight-forward use of div elements and all the legacy table elements have been removed.
The result is a "clean"... (7 Replies)
Discussion started by: Neo
7 Replies
9. UNIX for Beginners Questions & Answers
Hi,
I want to compare same column in two files, if values match then display the column or display "NA".
Ex :
File 1 :
123
abc
xyz
pqr
File 2:
122
aab
fdf
pqr
fff
qqq
rrr (1 Reply)
Discussion started by: hkoshekay
1 Replies
LEARN ABOUT NETBSD
mbtowc
MBTOWC(3) BSD Library Functions Manual MBTOWC(3)
NAME
mbtowc -- converts a multibyte character to a wide character
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdlib.h>
int
mbtowc(wchar_t * restrict pwc, const char * restrict s, size_t n);
DESCRIPTION
mbtowc() usually converts the multibyte character pointed to by s to a wide character, and stores it in the wchar_t object pointed to by pwc
if pwc is non-NULL and s points to a valid character. This function may inspect at most n bytes of the array beginning from s.
In state-dependent encodings, s may point to the special sequence bytes to change the shift-state. Although such sequence bytes correspond
to no individual wide-character code, mbtowc() changes its own state by the sequence bytes and treats them as if they are a part of the sub-
sequence multibyte character.
Unlike mbrtowc(3), the first n bytes pointed to by s need to form an entire multibyte character. Otherwise, this function causes an error.
Calling any other functions in Standard C Library (libc, -lc) never changes the internal state of mbtowc(), except for calling setlocale(3)
with changing the LC_CTYPE category of the current locale. Such setlocale(3) call causes the internal state of this function to be indeter-
minate.
The behaviour of mbtowc() is affected by the LC_CTYPE category of the current locale.
There are special cases:
s == NULL mbtowc() initializes its own internal state to an initial state, and determines whether the current encoding is state-depen-
dent. This function returns 0 if the encoding is state-independent, otherwise non-zero. In this case, pwc is completely
ignored.
pwc == NULL mbtowc() executes the conversion as if pwc is non-NULL, but a result of the conversion is discarded.
n == 0 In this case, the first n bytes of the array pointed to by s never form a complete character. Thus, the mbtowc() always fails.
RETURN VALUES
Normally, the mbtowc() returns:
0 s points to a nul byte ('