cp1252 encoding not found on Free BSD 8
hi, This is a bug reported last August for Mac, but it is also happening for freebsd8.2 (amd64). https://bugs.launchpad.net/lxml/+bug/707396 Python 2.7.1 (r271:86832, Apr 5 2011, 13:19:14) [GCC 4.2.1 20070719 [FreeBSD]] on freebsd8 from lxml import etree parser = etree.HTMLParser(encoding='cp1252') Traceback (most recent call last): File "lxml_bug.py", line 11, in <module> parser = etree.HTMLParser(encoding='cp1252') File "parser.pxi", line 1423, in lxml.etree.HTMLParser.__init__ (src/lxml/lxml.etree.c:81303) File "parser.pxi", line 743, in lxml.etree._BaseParser.__init__ (src/lxml/lxml.etree.c:76172) LookupError: unknown encoding: 'cp1252' Here are my details: Python : sys.version_info(major=2, minor=7, micro=1, releaselevel='final', serial=0) lxml.etree : (2, 3, 1, 0) libxml used : (2, 7, 8) libxml compiled : (2, 7, 8) libxslt used : (1, 1, 26) libxslt compiled : (1, 1, 26) platform.architecture() ('64bit', 'ELF') thanks, --Tim Arnold
Tim, I had a similar issue but on Windows and cp1250. I started digging in the source and stuck somwhere in 3rd party libraries and I think it was iconv. What helped me then, was explicitly changing the console's encoding with "chcp" command to the one supporting cp1250 encoding. I know it's not related to FreeBSD, but maybe you will find this information somehow usefull :) Regards Piotrek W dniu 21 lutego 2012 19:00 użytkownik Tim Arnold <Tim.Arnold@sas.com>napisał:
hi,****
This is a bug reported last August for Mac, but it is also happening for freebsd8.2 (amd64).****
https://bugs.launchpad.net/lxml/+bug/707396****
** **
Python 2.7.1 (r271:86832, Apr 5 2011, 13:19:14)****
[GCC 4.2.1 20070719 [FreeBSD]] on freebsd8****
** **
from lxml import etree****
parser = etree.HTMLParser(encoding='cp1252')****
** **
Traceback (most recent call last):****
File "lxml_bug.py", line 11, in <module>****
parser = etree.HTMLParser(encoding='cp1252')****
File "parser.pxi", line 1423, in lxml.etree.HTMLParser.__init__ (src/lxml/lxml.etree.c:81303)****
File "parser.pxi", line 743, in lxml.etree._BaseParser.__init__ (src/lxml/lxml.etree.c:76172)****
LookupError: unknown encoding: 'cp1252'****
** **
Here are my details:****
Python : sys.version_info(major=2, minor=7, micro=1, releaselevel='final', serial=0)****
lxml.etree : (2, 3, 1, 0)****
libxml used : (2, 7, 8)****
libxml compiled : (2, 7, 8)****
libxslt used : (1, 1, 26)****
libxslt compiled : (1, 1, 26)****
** **
platform.architecture()****
('64bit', 'ELF')****
** **
thanks,****
--Tim Arnold****
** **
_________________________________________________________________ Mailing list for the lxml Python XML toolkit - http://lxml.de/ lxml@lxml.de https://mailman-mail5.webfaction.com/listinfo/lxml
Tim Arnold, 21.02.2012 19:00:
This is a bug reported last August for Mac, but it is also happening for freebsd8.2 (amd64). https://bugs.launchpad.net/lxml/+bug/707396
Python 2.7.1 (r271:86832, Apr 5 2011, 13:19:14) [GCC 4.2.1 20070719 [FreeBSD]] on freebsd8
from lxml import etree parser = etree.HTMLParser(encoding='cp1252')
Traceback (most recent call last): File "lxml_bug.py", line 11, in <module> parser = etree.HTMLParser(encoding='cp1252') File "parser.pxi", line 1423, in lxml.etree.HTMLParser.__init__ (src/lxml/lxml.etree.c:81303) File "parser.pxi", line 743, in lxml.etree._BaseParser.__init__ (src/lxml/lxml.etree.c:76172) LookupError: unknown encoding: 'cp1252'
I'm neither a Mac nor BSD user, so I can't comment on it. Could you figure out what version of libiconv you are using and if your copy of libxml2 depends on it? Please comment in the bug tracker if you find anything useful. Stefan
Thanks Stefan. Here is what I've found so far. I've updated the bug report and will continue with any other needed info there. I'm posting here only for the latest info. And thanks Piotr, I appreciate your help, but with FreeBSD I don't think your solution will work for me. Here is the latest info: ldd libxml2.so libxml2.so: libz.so.5 => /lib/libz.so.5 (0x800889000) libiconv.so.3 => /usr/local/lib/libiconv.so.3 (0x800e4c000) libm.so.5 => /lib/libm.so.5 (0x801046000) libc.so.7 => /lib/libc.so.7 (0x800647000) ldd /usr/local/lib/libiconv.so.3 /usr/local/lib/libiconv.so.3: libc.so.7 => /lib/libc.so.7 (0x800647000) iconv -l | grep -i cp1252 CP1252 MS-ANSI WINDOWS-1252 -----Original Message----- From: lxml-bounces@lxml.de [mailto:lxml-bounces@lxml.de] On Behalf Of Stefan Behnel Sent: Wednesday, February 22, 2012 2:48 AM To: lxml@lxml.de Subject: Re: [lxml] cp1252 encoding not found on Free BSD 8 Tim Arnold, 21.02.2012 19:00:
This is a bug reported last August for Mac, but it is also happening for freebsd8.2 (amd64). https://bugs.launchpad.net/lxml/+bug/707396
Python 2.7.1 (r271:86832, Apr 5 2011, 13:19:14) [GCC 4.2.1 20070719 [FreeBSD]] on freebsd8
from lxml import etree parser = etree.HTMLParser(encoding='cp1252')
Traceback (most recent call last): File "lxml_bug.py", line 11, in <module> parser = etree.HTMLParser(encoding='cp1252') File "parser.pxi", line 1423, in lxml.etree.HTMLParser.__init__ (src/lxml/lxml.etree.c:81303) File "parser.pxi", line 743, in lxml.etree._BaseParser.__init__ (src/lxml/lxml.etree.c:76172) LookupError: unknown encoding: 'cp1252'
I'm neither a Mac nor BSD user, so I can't comment on it. Could you figure out what version of libiconv you are using and if your copy of libxml2 depends on it? Please comment in the bug tracker if you find anything useful. Stefan _________________________________________________________________ Mailing list for the lxml Python XML toolkit - http://lxml.de/ lxml@lxml.de https://mailman-mail5.webfaction.com/listinfo/lxml
participants (3)
-
Piotr Owcarz
-
Stefan Behnel
-
Tim Arnold