Re: problem installing Encode module

2004-11-09 Thread Nick Ing-Simmons
Piyush Shourie <[EMAIL PROTECTED]> writes:
>Hi,
>
> 
>
>I am not able to compile Encode module, as one of the pre-requisites of
>Encode module, Text::Iconv does not compile on Windows platform. 

When did that happen?

>I am
>currently using ActiveState Perl 5.6.1, and cannot upgrade to the newer
>version of Perl because of project requirements.
>
> 
>
>Please let me know if there is some available ppd for installation of
>the said module on Windows platform.
>
> 
>
>In case there is no ppd available, kindly look into the error received
>and let me know if there is anything I could do to resolve the issue:
>
> 
>
> 
>
>C:\Modules\Text-Iconv-1.2>perl Makefile.PL
>
>Checking if your kit is complete...
>
>Looks good
>
>Writing Makefile for Text::Iconv
>
> 
>
>C:\Modules\Text-Iconv-1.2>nmake
>
> 
>
>Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
>
>Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
>
> 
>
>cp Iconv.pm blib\lib\Text\Iconv.pm
>
>AutoSplitting blib\lib\Text\Iconv.pm (blib\lib\auto\Text\Iconv)
>
>C:\Perl\bin\Perl.exe -IC:\Perl\lib -IC:\SiteMinderPe
>
>rl\lib C:\Perl\lib\ExtUtils/xsubpp  -typemap C:\Perl\lib\Ext
>
>Utils\typemap -typemap typemap Iconv.xs > Iconv.xsc && C:\Perl\bin\Per
>
>l.exe -IC:\Perl\lib -IC:\Perl\lib -MExtUtils::Command -e mv
>
>Iconv.xsc Iconv.c
>
>cl -c  -nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT
>-DHAVE_DE
>
>S_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
>-DPERL_MSVCRT_READFIX -O1 -
>
>MD -DNDEBUG-DVERSION=\"1.2\"  -DXS_VERSION=\"1.2\"  -IC:\Perl\lib\
>
>CORE  Iconv.c
>
>Iconv.c
>
>"Running Mkbootstrap for Text::Iconv ()"
>
>C:\Perl\bin\Perl.exe -IC:\Perl\lib -IC:\SiteMinderPe
>
>rl\lib -MExtUtils::Command -e chmod 644 Iconv.bs
>
>C:\Perl\bin\Perl.exe "-IC:\Perl\lib" "-IC:\SiteMinde
>
>rPerl\lib" -MExtUtils::Mksymlists  -e "Mksymlists('NAME' =>
>'Text::Iconv', 'DLBA
>
>SE' => 'Iconv', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  },
>'DL_VAR
>
>S' => []);"
>
>link -out:blib\arch\auto\Text\Iconv\Iconv.dll -dll -nologo
>-nodefaultlib
>
> -release  -libpath:"C:\Perl\lib\CORE"  -machine:x86 Iconv.obj   C:\Si
>
>teMinderPerl\lib\CORE\perl56.lib oldnames.lib kernel32.lib user32.lib
>gdi32.lib
>
>winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib
>oleaut32.lib  neta
>
>pi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib
>odbccp32
>
>.lib msvcrt.lib -def:Iconv.def
>
>   Creating library blib\arch\auto\Text\Iconv\Iconv.lib and object
>blib\arch\aut
>
>o\Text\Iconv\Iconv.exp
>
>Iconv.obj : error LNK2001: unresolved external symbol __imp__libiconv
>
>Iconv.obj : error LNK2001: unresolved external symbol
>__imp__libiconv_open
>
>Iconv.obj : error LNK2001: unresolved external symbol
>__imp__libiconv_close
>
>blib\arch\auto\Text\Iconv\Iconv.dll : fatal error LNK1120: 3 unresolved
>external
>
>s
>
>NMAKE : fatal error U1077: 'link' : return code '0x460'
>
>Stop.
>
> 
>
> 
>
> 
>
> 
>
> 
>
>Thanks,
>
>Piyush



Re: problem installing Encode module

2004-11-09 Thread Steve Hay
Nick Ing-Simmons wrote:

>Piyush Shourie <[EMAIL PROTECTED]> writes:
>  
>
>>Hi,
>>
>>
>>
>>I am not able to compile Encode module, as one of the pre-requisites of
>>Encode module, Text::Iconv does not compile on Windows platform. 
>>
>>
>
>When did that happen?
>
Clearly it didn't, since Text::Iconv isn't in the core perl distro ;)

I assumed that the poster was using Text::Iconv /instead of/ Encode, 
since Encode requires 5.7.3+ but the poster is using 5.6.1:-

>
>  
>
>>I am
>>currently using ActiveState Perl 5.6.1, and cannot upgrade to the newer
>>version of Perl because of project requirements.
>>

- Steve




This email has been scanned for viruses and content by the Radan Computational 
Webshield Appliances.



Re: problem installing Encode module

2004-11-09 Thread Steve Hay
Piyush Shourie wrote:

>Steve,
>
>Libiconv is present in my local machine, and is there in LIB PATH also.
>However, still the same error is displayed.
>
>Can you provide me with some hints to rectify the said error?
>
OK, I tried it myself now.  It seems that although your iconv library 
path is in your LIB path, the library was not in the list of libraries 
being linked against:  "iconv.lib" isn't in this list:

link -out:blib\arch\auto\Text\Iconv\Iconv.dll -dll -nologo -nodefaultlib 
-release  -libpath:"C:\Perl\lib\CORE"  -machine:x86 Iconv.obj   
C:\SiteMinderPerl\lib\CORE\perl56.lib oldnames.lib kernel32.lib 
user32.lib gdi32.libw inspool.lib  comdlg32.lib advapi32.lib shell32.lib 
ole32.lib oleaut32.lib  netapi32.lib uuid.lib wsock32.lib mpr.lib 
winmm.lib  version.lib odbc32.lib odbccp32.lib msvcrt.lib -def:Iconv.def

So the build process would have found it if it had looked for it, but it 
wasn't actually looking.

To tell the build process to look for the library, start again with 
something like:

perl Makefile.PL LIBS=iconv.lib

(or use something like "perl Makefile.PL LIBS=C:\libiconv\lib\iconv.lib" 
if your libiconv library path isn't in %LIB%.)

- Steve




This email has been scanned for viruses and content by the Radan Computational 
Webshield Appliances.



Re: problem installing Encode module

2004-11-09 Thread Steve Hay
[Please keep your replies on the [EMAIL PROTECTED] list.  Use "Reply 
All" rather than "Reply".]

Piyush Shourie wrote:

>Steve,
>
>I have tried the ways suggested by you, but am not able to build the
>module as yet.
>
>The actual error displayed is as follows:
>
>
>
>
>C:\Modules\Text-Iconv-1.4>perl Makefile.PL
>LIBS=C:\Modules\libiconv-1.8-1-lib\li
>b
>
I also found that Text-Iconv-1.4 had build problems, even with the 
LIBS=... bit.  It obviously needs a little work to make it more 
Win32-friendly.

You were previously using Text-Iconv-1.2.  That builds fine for me, so 
give that a go.

- Steve

>Your settings:
>  LIBS: C:\Modules\libiconv-1.8-1-lib\lib
>  INC:
>Checking for iconv ... The system cannot find the path specified.
>ok (iconv apparently in libc)
>
>NOTE: If you have multiple iconv implementations installed, you might
>  want to make sure that I've found the one you want to use.
>  If necessary, you can explicitly specify paths like this:
>
>  C:\SiteMinderPerl\bin\Perl.exe Makefile.PL LIBS='-L/path/to/lib'
>INC='-I/p
>ath/to/include'
>
>Checking if your kit is complete...
>Looks good
>Writing Makefile for Text::Iconv
>
>C:\Modules\Text-Iconv-1.4>nmake
>
>Microsoft (R) Program Maintenance Utility   Version 6.00.8168.0
>Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
>
>cp Iconv.pm blib\lib\Text\Iconv.pm
>AutoSplitting blib\lib\Text\Iconv.pm (blib\lib\auto\Text\Iconv)
>C:\SiteMinderPerl\bin\Perl.exe -IC:\SiteMinderPerl\lib
>-IC:\SiteMinderPe
>rl\lib C:\SiteMinderPerl\lib\ExtUtils/xsubpp  -typemap
>C:\SiteMinderPerl\lib\Ext
>Utils\typemap -typemap typemap Iconv.xs > Iconv.xsc &&
>C:\SiteMinderPerl\bin\Per
>l.exe -IC:\SiteMinderPerl\lib -IC:\SiteMinderPerl\lib
>-MExtUtils::Command -e mv
>Iconv.xsc Iconv.c
>cl -c  -nologo -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT
>-DHAVE_DE
>S_FCRYPT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
>-DPERL_MSVCRT_READFIX -O1 -
>MD -DNDEBUG-DVERSION=\"1.4\"  -DXS_VERSION=\"1.4\"
>-IC:\SiteMinderPerl\lib\
>CORE  Iconv.c
>Iconv.c
>"Running Mkbootstrap for Text::Iconv ()"
>C:\SiteMinderPerl\bin\Perl.exe -IC:\SiteMinderPerl\lib
>-IC:\SiteMinderPe
>rl\lib -MExtUtils::Command -e chmod 644 Iconv.bs
>C:\SiteMinderPerl\bin\Perl.exe "-IC:\SiteMinderPerl\lib"
>"-IC:\SiteMinde
>rPerl\lib" -MExtUtils::Mksymlists  -e "Mksymlists('NAME' =>
>'Text::Iconv', 'DLBA
>SE' => 'Iconv', 'DL_FUNCS' => {  }, 'FUNCLIST' => [], 'IMPORTS' => {  },
>'DL_VAR
>S' => []);"
>link -out:blib\arch\auto\Text\Iconv\Iconv.dll -dll -nologo
>-nodefaultlib
> -release  -libpath:"C:\SiteMinderPerl\lib\CORE"  -machine:x86 Iconv.obj
>C:\Si
>teMinderPerl\lib\CORE\perl56.lib
>C:\PROGRA~1\MIAF9D~1\VC98\LIB\oldnames.lib C:\P
>ROGRA~1\MIAF9D~1\VC98\LIB\kernel32.lib
>C:\PROGRA~1\MIAF9D~1\VC98\LIB\user32.lib
>C:\PROGRA~1\MIAF9D~1\VC98\LIB\gdi32.lib
>C:\PROGRA~1\MIAF9D~1\VC98\LIB\winspool.l
>ib C:\PROGRA~1\MIAF9D~1\VC98\LIB\comdlg32.lib
>C:\PROGRA~1\MIAF9D~1\VC98\LIB\adva
>pi32.lib C:\PROGRA~1\MIAF9D~1\VC98\LIB\shell32.lib
>C:\PROGRA~1\MIAF9D~1\VC98\LIB
>\ole32.lib C:\PROGRA~1\MIAF9D~1\VC98\LIB\oleaut32.lib
>C:\PROGRA~1\MIAF9D~1\VC98\
>LIB\netapi32.lib C:\PROGRA~1\MIAF9D~1\VC98\LIB\uuid.lib
>C:\PROGRA~1\MIAF9D~1\VC9
>8\LIB\wsock32.lib C:\PROGRA~1\MIAF9D~1\VC98\LIB\mpr.lib
>C:\PROGRA~1\MIAF9D~1\VC9
>8\LIB\winmm.lib C:\PROGRA~1\MIAF9D~1\VC98\LIB\version.lib
>C:\PROGRA~1\MIAF9D~1\V
>C98\LIB\odbc32.lib C:\PROGRA~1\MIAF9D~1\VC98\LIB\odbccp32.lib
>C:\PROGRA~1\MIAF9D
>~1\VC98\LIB\msvcrt.lib -def:Iconv.def
>   Creating library blib\arch\auto\Text\Iconv\Iconv.lib and object
>blib\arch\aut
>o\Text\Iconv\Iconv.exp
>Iconv.obj : error LNK2001: unresolved external symbol __imp__libiconv
>Iconv.obj : error LNK2001: unresolved external symbol
>__imp__libiconv_open
>Iconv.obj : error LNK2001: unresolved external symbol
>__imp__libiconv_close
>blib\arch\auto\Text\Iconv\Iconv.dll : fatal error LNK1120: 3 unresolved
>external
>s
>NMAKE : fatal error U1077: 'link' : return code '0x460'
>Stop.
>
>
>
>One more suggestion: If you have tried the same yourself, can you help
>me out by packaging the binaries built into a PPM package.
>
>Hope the above-mentioned error message provides you a better view of the
>problem.
>
>Thanks,
>Piyush
>





This email has been scanned for viruses and content by the Radan Computational 
Webshield Appliances.



clearing the utf8 flag

2004-11-09 Thread Paul Bijnens
I have a program that reads and writes (among others) strings that
should be utf8 encoded.  I say "should", because somewhere deep
inside the dark corners of that program, sometimes, the utf8 flag on
a string is lost. (I'm still investigating where, tips to attack
such a problem are welcome.)
When writing the string, the program clears the utf8 flag
and writes a simple string of octets using:
$s = encode("utf8", $s) if $s =~ /[^\x00-\x7f]/;
$n = length($s);   # yes, we need length in bytes
...
print $s;
Why would someone test for pure 7-bit strings instead of:
$s = encode("utf8", $s) if Encode::is_utf8($s);
which seems superior to avoid double utf8 encodings,
should the utf8-flag be lost.  And it's faster.
Or even simply: Encode::_utf8_off($s)
The problem is that I'm usually wrong.  Am I this time?
Am I missing something?  Or do I need more coffee?
--
Paul Bijnens, XplanationTel  +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUMFax  +32 16 397.512
http://www.xplanation.com/  email:  [EMAIL PROTECTED]
***
* I think I've got the hang of it now:  exit, ^D, ^C, ^\, ^Z, ^Q, F6, *
* quit,  ZZ, :q, :q!,  M-Z, ^X^C,  logoff, logout, close, bye,  /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt,  abort,  hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e,  kill -1 $$,  shutdown, *
* kill -9 1,  Alt-F4,  Ctrl-Alt-Del,  AltGr-NumLock,  Stop-A,  ...*
* ...  "Are you sure?"  ...   YES   ...   Phew ...   I'm out  *
***



Re: clearing the utf8 flag

2004-11-09 Thread Dan Kogai
On Nov 10, 2004, at 01:30, Paul Bijnens wrote:
I have a program that reads and writes (among others) strings that
should be utf8 encoded.  I say "should", because somewhere deep
inside the dark corners of that program, sometimes, the utf8 flag on
a string is lost. (I'm still investigating where, tips to attack
such a problem are welcome.)
Even when you try to set UTF-8 flag on strings which consists entirely 
of ASCII ( /^[\x00-\x7f]$/ ) the UTF-8 will not be on.  See "The UTF-8 
flag" section of 'perldoc Encode'.  Here is the short summary.

perldoc Encode
   o When you decode, the resulting utf8 flag is on unless you can 
unam-
 biguously represent data.  Here is the definition of 
dis-ambiguity.

 After "$utf8 = decode('foo', $octet);",
   When $octet is...   The utf8 flag in $utf8 is
   -
   In ASCII only (or EBCDIC only)OFF
   In ISO-8859-1  ON
   In any other Encoding  ON
   -
 As you see, there is one exception, In ASCII.  That way you 
can assue
 Goal #1.  And with Encode Goal #2 is assumed but you still 
have to be
 careful in such cases mentioned in CAVEAT paragraphs.

When writing the string, the program clears the utf8 flag
and writes a simple string of octets using:
$s = encode("utf8", $s) if $s =~ /[^\x00-\x7f]/;
$n = length($s);   # yes, we need length in bytes
...
print $s;
If what you need is byte length, you can simply "use bytes" as follows. 
 binmode is for print().

use bytes (); # avoid imports
binmode STDOUT => ":utf8";
my $s = "\x{5c0f}\x{98fc} \x{5f3e}";
# ...
my $n = length($s);ch
my $l = bytes::length($s);
# ...
print $s;
Why would someone test for pure 7-bit strings instead of:
$s = encode("utf8", $s) if Encode::is_utf8($s);
For most cases you don't have to and you should not have to (unless you 
maintain Encode and/or perl :).  Complex it may be, the internal UTF-8 
flag was the best way to harness UTF-8 while keeping legacy, 
byte-oriented scripts compatible.

which seems superior to avoid double utf8 encodings,
shoue ld the utf8-flag be lost.  And it's faster.
Or even simply: Encode::_utf8_off($s)
The problem is that I'm usually wrong.  Am I this time?
Am I missing something?  Or do I need more coffee?
I have to admit Encode and Perl 5.8-way of handling Unicode needs more 
recipes (Perl Cookbook 2nd Ed. does cover that issue on Ch. 8 but it 
was hardly enough).

Dan the Encode Maintainer