For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > September 2005 > encoding sting in UNIX environment using Windows codepage 1252..?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author encoding sting in UNIX environment using Windows codepage 1252..?
Vinu

2005-09-30, 8:00 am

Hi
I have one problem I want to convert one string in UNIX environment,
but that string should be converted using the windows codepage 1252.
Can anybody suggest a way to do this? What is the conversion descriptor
equivalent to Windows codepage 1252?

Thanks,
-- Vinu.

Maxim Yegorushkin

2005-09-30, 6:58 pm


Vinu wrote:
> Hi
> I have one problem I want to convert one string in UNIX environment,
> but that string should be converted using the windows codepage 1252.
> Can anybody suggest a way to do this? What is the conversion descriptor
> equivalent to Windows codepage 1252?


man iconv(3)

Vinu

2005-09-30, 6:59 pm

Hi

Iconv requires a "conversion descriptor" which is returned by
iconv_open (toCodeset, nl_langinfo (CODESET)) here for "toCodeset"
I have a encoding for windows codepage1252. Which is the equivalent to
it in UNIX ENVIRONMENT?

Thanks,
Vinu

Chuck Dillon

2005-09-30, 6:59 pm

Vinu wrote:
> Hi
> I have one problem I want to convert one string in UNIX environment,
> but that string should be converted using the windows codepage 1252.
> Can anybody suggest a way to do this? What is the conversion descriptor
> equivalent to Windows codepage 1252?
>
> Thanks,
> -- Vinu.
>


I suggest you ask your question in functional terms rather than
MS-Windows terms. It might help if you specify whether the string is
encoded in whatever 1252 is or you want it encoded into whatever 1252 is.

Also, specify what flavor(s) of *nix you want answers for. There's
probably not a portable answer.

-- ced

--
Chuck Dillon
Senior Software Engineer
NimbleGen Systems Inc.
Pascal Bourguignon

2005-09-30, 6:59 pm

"Vinu" <vinuwarrier@yahoo.com> writes:
> Iconv requires a "conversion descriptor" which is returned by
> iconv_open (toCodeset, nl_langinfo (CODESET)) here for "toCodeset"
> I have a encoding for windows codepage1252. Which is the equivalent to
> it in UNIX ENVIRONMENT?


I would have cited iconv(1) first.

$ iconv -l|grep 1252
CP1252//
WINDOWS-1252//

So I'd try "CP1252", "CP1252//", "WINDOWS-1252" or "WINDOWS-1252//".

--
"You question the worthiness of my code? I should kill you where you
stand!"
Vinu

2005-09-30, 6:59 pm


Chuck Dillon wrote:
> Vinu wrote:
>
> I suggest you ask your question in functional terms rather than
> MS-Windows terms. It might help if you specify whether the string is
> encoded in whatever 1252 is or you want it encoded into whatever 1252 is.
>
> Also, specify what flavor(s) of *nix you want answers for. There's
> probably not a portable answer.
>
> -- ced
>
> --
> Chuck Dillon
> Senior Software Engineer
> NimbleGen Systems Inc.



I want it in Solaris 5.8 I have to send a response to a windows machine
and it should be in Codepage1252 encoded from the current locale. In
Solaris I don't have that code page.

Vinu

Vinu

2005-09-30, 6:59 pm


Chuck Dillon wrote:
> Vinu wrote:
>
> I suggest you ask your question in functional terms rather than
> MS-Windows terms. It might help if you specify whether the string is
> encoded in whatever 1252 is or you want it encoded into whatever 1252 is.
>
> Also, specify what flavor(s) of *nix you want answers for. There's
> probably not a portable answer.
>
> -- ced
>
> --
> Chuck Dillon
> Senior Software Engineer
> NimbleGen Systems Inc.



I want it in Solaris 5.8 I have to send a response to a windows machine
and it should be in Codepage1252 encoded from the current locale. In
Solaris I don't have that code page.

Vinu

Vinu

2005-09-30, 6:59 pm

In my machine I don't have these CP1252 WINDOWS-1252. How I can get
these files.

Vinu

Pascal Bourguignon wrote:

> "Vinu" <vinuwarrier@yahoo.com> writes:
>
> I would have cited iconv(1) first.
>
> $ iconv -l|grep 1252
> CP1252//
> WINDOWS-1252//
>
> So I'd try "CP1252", "CP1252//", "WINDOWS-1252" or "WINDOWS-1252//".
>
> --
> "You question the worthiness of my code? I should kill you where you
> stand!"


Pascal Bourguignon

2005-09-30, 6:59 pm

"Vinu" <vinuwarrier@yahoo.com> writes:

> In my machine I don't have these CP1252 WINDOWS-1252. How I can get
> these files.


http://www.gnu.org/software/libiconv/

--
"Our users will know fear and cower before our software! Ship it!
Ship it and let them flee like the dogs they are!"
Bill Marcum

2005-09-30, 6:59 pm

On 30 Sep 2005 06:54:26 -0700, Vinu
<vinuwarrier@yahoo.com> wrote:
>
> I want it in Solaris 5.8 I have to send a response to a windows machine
> and it should be in Codepage1252 encoded from the current locale. In
> Solaris I don't have that code page.
>

You can use iso-8859-1 or -15 unless you need special characters such as
separate opening and closing quotes or the Windows encoding of the euro
sign.


--
If people are good only because they fear punishment, and hope for reward,
then we are a sorry lot indeed.
-- Albert Einstein
Henry Townsend

2005-09-30, 6:59 pm

Bill Marcum wrote:
> On 30 Sep 2005 06:54:26 -0700, Vinu
> <vinuwarrier@yahoo.com> wrote:
>
>
> You can use iso-8859-1 or -15 unless you need special characters such as
> separate opening and closing quotes or the Windows encoding of the euro
> sign.


But more generally, is there a mapping from the Windows "code page"
concept to Unix terms? I.e. given code page XYZ, how would someone know
what name to pass to iconv?

HT
Roger Leigh

2005-09-30, 6:59 pm

Henry Townsend <henry.townsend@not.here> writes:

> But more generally, is there a mapping from the Windows "code page"
> concept to Unix terms?


What do you mean by "Unix terms"?

$ locale | grep LC_CTYPE
LC_CTYPE="en_GB.UTF-8"

$ locale -k charmap
charmap="UTF-8"

Or use setlocale(3).

> I.e. given code page XYZ, how would someone know what name to pass
> to iconv?


$ iconv --list | grep ^CP[0-9]
CP037//
CP038//
CP273//
CP274//
CP275//
CP278//
CP280//
CP281//
CP282//
CP284//
CP285//
CP290//
CP297//
CP367//
CP420//
CP423//
CP424//
CP437//
CP500//
CP737//
CP775//
CP813//
CP819//
CP850//
CP851//
CP852//
CP855//
CP856//
CP857//
CP860//
CP861//
CP862//
CP863//
CP864//
CP865//
CP866//
CP866NAV//
CP868//
CP869//
CP870//
CP871//
CP874//
CP875//
CP880//
CP891//
CP903//
CP904//
CP905//
CP912//
CP915//
CP916//
CP918//
CP920//
CP922//
CP930//
CP932//
CP933//
CP935//
CP936//
CP937//
CP939//
CP949//
CP950//
CP1004//
CP1026//
CP1046//
CP1047//
CP1070//
CP1079//
CP1081//
CP1084//
CP1089//
CP1124//
CP1125//
CP1129//
CP1132//
CP1133//
CP1160//
CP1161//
CP1162//
CP1163//
CP1164//
CP1250//
CP1251//
CP1252//
CP1253//
CP1254//
CP1255//
CP1256//
CP1257//
CP1258//
CP1361//
CP10007//

--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com