Sponsored Content
Full Discussion: Explain iconv command
Top Forums UNIX for Beginners Questions & Answers Explain iconv command Post 303032460 by eskay on Monday 18th of March 2019 05:03:22 PM
Old 03-18-2019
But with iconv function Ñ is converted to N.. but I need to add a space at the end as it is a multi-byte character to not change the length. Is it possible?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

please explain the command

Hi all , please explain the following command : perl -e 'select(undef,undef,undef,.15)' Thanks and Regards Navatha (2 Replies)
Discussion started by: Navatha
2 Replies

2. UNIX for Dummies Questions & Answers

Can anyone explain what this command is doing?

Specifically what is the purpose of sed? What is f? Why is the 'cp f $phonefile' line needed when the script ‘goes live'? Why might that two commands following sed be commented out at the present time ( i.e., during development)? Thanks in... (2 Replies)
Discussion started by: knp808
2 Replies

3. Shell Programming and Scripting

Please Explain me this command

find . -type f -ctime +3 -exec mv {} /somedirectory/ \; in particular "-ctime v/s -mtime" and "difference between +3 and -3" (5 Replies)
Discussion started by: Rambo
5 Replies

4. Shell Programming and Scripting

Help with iconv command

Hi , I am using iconv command to convert a file in UTF-16 format to UTF-8 format. This command will work for few files but for some showing an error as bad input character. But if i copy the contents of the file for which it is showing "bad input character" to a new file and perform the... (0 Replies)
Discussion started by: Shruthi8818
0 Replies

5. UNIX for Dummies Questions & Answers

Help with iconv command

Hi , I am using iconv command to convert a file in UTF-16 format to UTF-8 format. This command will work for few files but for some showing an error as bad input character. But if i copy the contents of the file for which it is showing "bad input character" to a new file and perform the... (2 Replies)
Discussion started by: Shruthi8818
2 Replies

6. Shell Programming and Scripting

Characterset conversion problem using iconv command

Hi Friends, I am not able to conver character set from UTF-8 to IBM-284 throwing an error "cannot open convertor" . Could you please help me how to get out of this error. Below command is working fine iconv -f ISO8859-15 -t UTF-8 fromfile.txt > tofile.txt But the below command is... (2 Replies)
Discussion started by: sivakumarl
2 Replies

7. Shell Programming and Scripting

Help with command iconv

I need to convert a utf16 file to utf8. When i use the iconv command to do so it gives an error saying invalid function. When I ran the iconv -l function it did not list the utf16 and utf8 as part of its internal table. Is there anyway I can add these encodings in the library? Is there any other... (3 Replies)
Discussion started by: gaun
3 Replies

8. UNIX for Dummies Questions & Answers

Please explain this command?

Hi, I saw this. But I don't know why we need this? ls mydir > foo.txt ## I know what this will do, it will take the results and write to the file called foo.txt ls mydir > foo.txt 2>&1 ## Don't know why we need 2>&1 Thanks. (2 Replies)
Discussion started by: samnyc
2 Replies

9. Shell Programming and Scripting

Can any one explain this sqlplus command?

Hi , i am new to unix i need a small clarification regarding this sqlplus -s $USER_NAME/$PASSWD@$ORA_SID<< EOF >> SQL_CONN_LOG.log In the above command what is the meaning of <<EOF>> Thanks, krishna. (2 Replies)
Discussion started by: rams_krishna
2 Replies

10. Red Hat

Please help to explain the command

su - keibatch -c ""date ; /usr/local/kei/batch/apb/bin/JKEIKYK4140.sh -run "&$C$6&" WSUKE100201"" Not clear about : date ; /usr/local/kei/batch/apb/bin/JKEIKYK4140.sh -run "&$C$6&" WSUKE100201 Please help (2 Replies)
Discussion started by: honda_city
2 Replies
iconv(3)						     Library Functions Manual							  iconv(3)

NAME
iconv - Converts a string of characters from one codeset to another codeset LIBRARY
The iconv library (libiconv) SYNOPSIS
#include <iconv.h> size_t iconv( iconv_t cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); The following nonstandard interface is supported in libiconv only for compatibility with versions of DIGITAL UNIX earlier than Version 4.0: size_t iconv( iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: iconv(): XSH5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies the conversion descriptor that points to the correct codeset converter Points to a variable that points to the beginning of a buffer that contains the characters to be converted Points to an integer that contains the number of bytes in inbuf still to be converted Points to a variable that points to the buffer that contains the characters that have been converted Points to an integer that contains the number of free bytes in outbuf DESCRIPTION
The iconv() function converts a string of characters in inbuf into a different codeset and returns the results in outbuf. The required con- verter is identified by cd, which must be a valid descriptor returned by a previous successful call to the iconv_open() function. On calling, the inbytesleft parameter indicates the number of bytes in inbuf to be converted and outbytesleft indicates the number of available bytes in outbuf. For codesets that include shift-state sequences, a call to iconv() in which inbuf is or points to a null pointer places the cd conversion descriptor into its initial shift state. In this case, as long as outbuf is not (or does not point to) a null pointer, the call places in outbuf the byte sequence that changes the output buffer to its initial shift state. If the output buffer is not large enough to hold the entire reset sequence, the call fails and sets errno to [E2BIG]. Any subsequent calls in which inbuf is not (or does not point to) a null pointer cause the conversion to take place from the current state of the conversion descriptor. See the RESTRICTIONS section for informa- tion about support of shift-state encoding. If a sequence of input bytes does not form a character that is valid in the input codeset, conversion stops after the previous successfully converted character. If the input buffer ends with an incomplete character or shift sequence, conversion stops after the last byte sequence that was successfully converted to a character. If the output is not large enough to hold the entire sequence of converted characters, conversion stops just prior to the input byte sequence that would cause the output buffer to overflow. On return from the call: The inbuf value is updated to point to the byte following the last byte used successfully in conversion The inbytesleft value is decremented to reflect the number of input bytes still not converted The outbuf value is updated to point to the byte following the last output byte of successfully converted data The outbytesleft value is decremented to reflect the number of bytes still available in the output buffer. For codesets that include shift-state encoding, the conversion descriptor is updated to reflect the shift state in effect at the end of the last successfully converted byte sequence. It is possible for input data to include a character that is valid in the input codeset but for which an identical character does not exist in the output codeset. The output character for such cases is defined by the converter that iconv() applies when converting from one par- ticular codeset to another. In other words, the output character in this case can vary from one codeset converter to another. RESTRICTIONS
Currently, the operating system does not include locales whose codesets use shift-state encoding. Some sections of this reference page refer to iconv() behavior with respect to conversion of shift sequences. This information is included only for your convenience in devel- oping portable applications that run on multiple platforms, some of which may supply locales whose codesets do use shift-state encoding. RETURN VALUES
The iconv() function updates the variables pointed to by the call arguments to reflect the extent of the conversion and returns the number of non-identical conversions performed. If the function is successful and converts the entire input string, the value pointed to by inbytesleft will be 0 (zero). If an error occurs, the function returns (size_t)-1 and sets errno to indicate the condition. ERRORS
If any of the following conditions occur, the iconv() function sets errno to the corresponding value: The outbuf buffer is too small to contain all the converted characters. The character that causes the overflow is not converted and inbytesleft indicates the bytes left to be converted, including the character that caused the overflow. The inbuf parameter points to the first byte of the characters left to con- vert. The cd parameter does not specify a valid converter descriptor. An input character does not belong to the input codeset. No conver- sion is attempted on the invalid character and inbytesleft indicates the bytes left to be converted, including the first byte of the invalid character. The inbuf parameter points to the first byte of the invalid character sequence. The values of outbuf and outbytesleft are updated according to the number of characters that were previously converted. The last character or shift sequence in the inbuf parameter was not complete. The inbytesleft parameter indicates the number of input bytes still not converted. RELATED INFORMATION
Functions: iconv_close(3), iconv_open(3) Commands: iconv(1), genxlt(1) Others: iconv_intro(5), standards(5) delim off iconv(3)
All times are GMT -4. The time now is 11:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy