Comparing with other XML APIs, such as MSXML or IBM's Xcerces-C, the default Python XML APIs (xml.dom, etree, or even PyXML) does not provide full supports for multiple encodings. For example, if you comes from China, you might want to encode your document in GB2312/GBK or BIG5. However, you might receive some information like below when you are parsing it (tried on Python 2.6.2) :
<?xml version="1.0" encoding="GB2312"?>
<hello>world</hello>
import xml.dom.minidom
xml.dom.minidom.parse('test.gbk.xml')
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.6/xml/dom/minidom.py", line 1918, in parse
return expatbuilder.parse(file)
File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 924, in parse
result = builder.parseFile(fp)
File "/usr/lib/python2.6/xml/dom/expatbuilder.py", line 207, in parseFile
parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: unknown encoding: line 1, column 30
It's confusing to most of the Python newbies because the document above is actually a valid XML document. It's also surprising because python itself can correctly handle GB2312 since python 1.6.
But my friend, don't just start complaining: Python does nothing wrong.
The strange behavor comes from the library. Python uses Expat as the implementation of almost all XML libraries. Currently Expat supports very limited encodings: US-ASCII, UTF-8, UTF-16, and ISO-8859-1 (If you are working on Linux/UNIX, check man page of xmlwf tool). However, it is compliant with XML standard, section 2.2:
The mechanism for encoding character code points into bit patterns may vary from entity to entity. All XML processors MUST accept the UTF-8 and UTF-16 encodings of Unicode [Unicode]; the mechanisms for signaling which of the two is in use, or for bringing other encodings into play, are discussed later, in 4.3.3 Character Encoding in Entities.
As we see, XML standard requires only supports on UTF-8 and UTF-16, and XML parsers can freely make their decisions to support other encodings. Expat supports four encodings, that's all.
So, if you want to use XML with Python, please think about it carefully when choosing your default encodings. If there are requirements to support "any" encodings, don't just use Python blindly.
29 comments:
Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!
[u][b]Xrumer[/b][/u]
[b]Xrumer SEO Professionals
As Xrumer experts, we possess been using [url=http://www.xrumer-seo.com]Xrumer[/url] for a large fix for the time being and know how to harness the enormous power of Xrumer and go off it into a Spondulix machine.
We also yield the cheapest prices on the market. Many competitors devise charge 2x or square 3x and a a pile of the time 5x what we debt you. But we feel in providing gigantic help at a debilitated affordable rate. The entire point of purchasing Xrumer blasts is because it is a cheaper substitute to buying Xrumer. So we train to abide by that bit in mind and yield you with the cheapest censure possible.
Not only do we take the most successfully prices but our turnaround heyday payment your Xrumer posting is super fast. We intention secure your posting done ahead of you distinguish it.
We also cater you with a sated log of well-heeled posts on manifold forums. So that you can get the idea for yourself the power of Xrumer and how we get harnessed it to help your site.[/b]
[b]Search Engine Optimization
Using Xrumer you can expect to see thousands upon thousands of backlinks for your site. Myriad of the forums that your Location you will be posted on have great PageRank. Having your tie-in on these sites can truly serve establish up some top-grade grade recoil from links and uncommonly as well your Alexa Rating and Google PageRank rating via the roof.
This is making your put more and more popular. And with this increase in reputation as familiarly as PageRank you can expect to witness your milieu definitely superiority high in those Search Motor Results.
Traffic
The amount of conveyance that can be obtained nearby harnessing the power of Xrumer is enormous. You are publishing your locality to tens of thousands of forums. With our higher packages you may even be publishing your locality to HUNDREDS of THOUSANDS of forums. Create 1 collection on a popular forum will almost always rig out 1000 or so views, with communicate 100 of those people visiting your site. These days devise tens of thousands of posts on popular forums all getting 1000 views each. Your see trade longing associate sometimes non-standard due to the roof.
These are all targeted visitors that are interested or curious nearly your site. Imagine how assorted sales or leads you can fulfil with this colossal gang of targeted visitors. You are truly stumbling upon a goldmine primed to be picked and profited from.
Keep in mind, Traffic is Money.
[/b]
TRAVERSE B RECOVER YOUR CHEAP BURST TODAY:
http://www.xrumer-seo.com
[B]NZBsRus.com[/B]
Forget Crawling Downloads With NZB Downloads You Can Rapidly Find HD Movies, Console Games, MP3s, Applications & Download Them at Accelerated Rates
[URL=http://www.nzbsrus.com][B]Usenet Search[/B][/URL]
Infatuation casinos? endure over this inexperienced [url=http://www.realcazinoz.com]casino[/url] manager and provisions online casino games like slots, blackjack, roulette, baccarat and more at www.realcazinoz.com .
you can also into our untrained [url=http://freecasinogames2010.webs.com]casino[/url] grip at http://freecasinogames2010.webs.com and prevail more than out-and-out genially misled !
another lone [url=http://www.ttittancasino.com]casino spiele[/url] concatenation of events is www.ttittancasino.com , because german gamblers, division in well-wishing online casino bonus.
Someone deleted several links from solidfiles and netload servers.
From now, we will use www.tinyurlalternative.com as our default [url=http://www.tinyurlalternative.com]url shortener[/url], so every url will be there and visible for everyone.
You can choose from several great [url=http://kfc.ms]short url[/url] address like:
kfc.ms easysharelink.info jumpme.info megauploadlink.info megavideolink.info mygamelink.info myrapidsharelink.info mytorrentlink.info myurlshortener.com mywarezlink.info urlredirect.info urlshrinker.info weblinkshortener.com youtubelink.info and many others.
They maintain over 60 different available domains and the [url=http://myurlshortener.com]url shortener[/url] service work well for free without any registration needed.
So we assume it is good idea and suggest you to use [url=http://urlredirect.info]url redirect[/url] service too!
Thank you.
black dating free services [url=http://loveepicentre.com/]online sim dating games[/url] age find singles great love profiles friend back giving kids http://loveepicentre.com/ example best online dating male profile to attract attention
Axiotron Laptop [url=http://www.hqlaptopbatteries.com/-tx2000-laptopbatterymodel493.html]notebook battery[/url] IBM laptop battery http://www.hqlaptopbatteries.com/-m400-s4032-laptopbatterymodel1982.html laptop comparison
Fujitsu Laptop [url=http://www.hqlaptopbatteries.com/-3505wlmi-laptopbatterymodel1274.html]Laptop search and advice[/url] Acer Laptop http://www.hqlaptopbatteries.com/-1905-s801-laptopbatterymodel2033.html Professional Laptop Battery Wholesale Site
compare prices laptop batteries [url=http://www.hqlaptopbatteries.com/-4080-laptopbatterymodel145.html]Averatec Laptop[/url] laptop battery http://www.hqlaptopbatteries.com/-3005lci-laptopbatterymodel1377.html Fujitsu Laptop
Hi all,
I found very good source of finding dofollow high parerank backlinks. Even from real PR10.
I cant imagine value of a real pr10.
I would like to share with you all about how i succeded to rank on 1st page on google.
prseo@hotmail.com
http://Www.playhitmusics.com
Nice fill someone in on and this post helped me alot in my college assignement. Thanks you on your information.
You could easily be making money online in the underground world of [URL=http://www.www.blackhatmoneymaker.com]blackhat make money[/URL], It's not a big surprise if you haven’t heard of it before. Blackhat marketing uses little-known or misunderstood avenues to build an income online.
Hey,
I mostly visits this website[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url]Plenty of useful information on cppof286.blogspot.com. Do you pay attention towards your health?. Are you really serious about your weight?. Research shows that almost 80% of all USA adults are either fat or overweight[url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips].[/url] Hence if you're one of these citizens, you're not alone. In fact, most of us need to lose a few pounds once in a while to get sexy and perfect six pack abs. Now the question is how you are planning to have quick weight loss? Quick weight loss can be achived with little effort. If you improve some of your daily diet habbits then, its like piece of cake to quickly lose weight.
About me: I am author of [url=http://www.weightrapidloss.com/lose-10-pounds-in-2-weeks-quick-weight-loss-tips]Quick weight loss tips[/url]. I am also mentor who can help you lose weight quickly. If you do not want to go under difficult training program than you may also try [url=http://www.weightrapidloss.com/acai-berry-for-quick-weight-loss]Acai Berry[/url] or [url=http://www.weightrapidloss.com/colon-cleanse-for-weight-loss]Colon Cleansing[/url] for effective weight loss.
medical supplies philadelphia [url=http://usadrugstoretoday.com/products/kamasutra-intensity-condoms.htm]kamasutra intensity condoms[/url] syntax disorder http://usadrugstoretoday.com/products/flomax.htm diabetes 2 cure http://usadrugstoretoday.com/products/propecia.htm
albany alternative medicine new york [url=http://usadrugstoretoday.com/products/dipyridamole.htm]dipyridamole[/url] diabetes self managment magazine [url=http://usadrugstoretoday.com/products/xtz--energy-booster-.htm]glomerulonephritis and diet[/url]
http://newrx.in/restlessness/restlessness
[url=http://newrx.in/bisoprolol/bisoprolol-fumarate-10mg]drug statistics for louisiana[/url] cialis sample [url=http://newrx.in/levitra/followup-levitra-post]followup levitra post[/url]
should drugs be illegal essay http://newrx.in/carbohydrates/what-foods-are-high-in-carbohydrates
[url=http://newrx.in/fluocinolone/fluocinolone-acetoride]philippine drugstores[/url] list of universities offering pharmacy couress in germany [url=http://newrx.in/flonase/cardizem-cd-procardia-xl-metronidazole-ranitidine-flonase]cardizem cd procardia xl metronidazole ranitidine flonase[/url]
home remedies for passing a drug test http://newrx.in/flonase/cpap-snoring-flonase-prescription
[url=http://newrx.in/imitrex/imitrex-stat-dose-use]pharmacy schools in eerie pennsylvania[/url] teenage erectile dysfunction [url=http://newrx.in/cholesterol/adl-cholesterol]adl cholesterol[/url] pinnacle drug testing [url=http://newrx.in/letrozole/letrozole]letrozole[/url]
http://meen.in/cla/cla-safety-uk-regulation
[url=http://meen.in/celebrex/celebrex-fda-medicine-vioxx]fda approved appetite suppression drug over the counter[/url] pregnancy category b drugs [url=http://meen.in/fluvoxamine/fluvoxamine-side-effects]fluvoxamine side effects[/url]
how drugs affect school http://meen.in/cefdinir/cefdinir-and-orange-bowel-movement
[url=http://meen.in/cialis/cialis-super-viagra]uni interview help for pharmacy[/url] cialis impotence drug eli lilly co [url=http://meen.in/escitalopram/escitalopram-citalopram]escitalopram citalopram[/url]
clincal pharmacy services quality records http://meen.in/etidronate/etidronate-disodium-monograph
[url=http://meen.in/fexofenadine/fexofenadine-drug]date rate drug[/url] erectile dysfuntion and fertilitly [url=http://meen.in/celecoxib/celebrex-http-wwwmedicinenetcom-celecoxib-articlehtm]celebrex http wwwmedicinenetcom celecoxib articlehtm[/url] prescription drugs ultram [url=http://meen.in/clarinex/clarinex-claritin-versus]clarinex claritin versus[/url]
finance automobile http://latestcarnews.in/triumph/dimensions-of-the-arc-de-triumph mercedes sprinter vans
[url=http://latestcarnews.in/scion/custom-scion-xb]automobile association wellington[/url] columbus auto dealers [url=http://latestcarnews.in/saab/saab-abbot-performance]saab abbot performance[/url]
snow plow 1500 dodge http://latestcarnews.in/seat/seat-cover-for-1990-gmc-step-side-pickup
[url=http://latestcarnews.in/saab/maury-cadillac-saab]volkswagen keys[/url] mercedes high mileage [url=http://latestcarnews.in/supermoto/klx-110-supermoto]klx 110 supermoto[/url]
kirk auto http://latestcarnews.in/yamaha/hudson-yamaha
[url=http://latestcarnews.in/romeo/alfa-romeo-164-timing-marks-91-93]auto glass repair industry report[/url] automobile mercedes lube points [url=http://latestcarnews.in/plymouth/nylon-bar-plymouth-uk]nylon bar plymouth uk[/url]
harry potter time travel fics http://wikitravel.in/expedia/expedia-plane satellite internet travel aywhre
[url=http://wikitravel.in/flight/bobby-pin-flight-bag]travel rewards bank of america credit card mastercard[/url] hotel travel cupons [url=http://wikitravel.in/map/map-of-sao-miguel]map of sao miguel[/url]
travel and air and deals and online http://wikitravel.in/expedia/expedia-web
[url=http://wikitravel.in/tourism/south-america-tourism]tollsworth travel lodge[/url] electrical engineer will travel and fix your problems contract [url=http://wikitravel.in/disneyland/disneyland-closure]disneyland closure[/url]
webcrawler mac travel http://wikitravel.in/airline/singapore-airline-travel student travel site [url=http://wikitravel.in/cruise/boston-to-bermuda-cruise]boston to bermuda cruise[/url]
kleinspitz http://topcitystyle.com/armani-new-brand8.html baby girl christmas clothes [url=http://topcitystyle.com/just-cavalli-tank-top-for-women-black-item2371.html]dallas fashion photographer[/url] clothes shopping online
http://topcitystyle.com/-flip-flops-category83.html old fashioned tomato pie [url=http://topcitystyle.com/s-tracksuits-size10.html]lauren kain cockold[/url]
fashion design schools http://topcitystyle.com/philipp-plein-funky-dress-with-sculls-black--item1277.html purple shoes for ladies [url=http://topcitystyle.com/navy-blue-grey-tracksuits-color216.html]ecco golf shoes[/url] fashion furniture fresno
http://topcitystyle.com/long-sleeve-tops-dolce-amp-gabbana-category6.html sweeties fashion [url=http://topcitystyle.com/women-page24.html]air jordan spikke shoes[/url]
american adult enterainment expo http://xwe.in/shemale/free-shemale-masterbation
[url=http://xwe.in/bdsm/bdsm-bondage-clip-gratuit]adult movies of women with abnormal nipples[/url] hollow dildo uk [url=http://xwe.in/adult-video/adult-footed-pajamas]adult footed pajamas[/url]
forced love porn http://xwe.in/teen-ass/alicia-silverstone-ass
[url=http://xwe.in/fetish/fetish-girl-ninchen]sexy thick leggs[/url] adult priceless parodies [url=http://xwe.in/bdsm/electric-bdsm]electric bdsm[/url]
anal masterbation women http://xwe.in/adult-video/free-adult-strip-games
[url=http://xwe.in/blowjob/nude-clelebrity-sex-oral-blowjob-butt]honduras porn[/url] best adult sex games online [url=http://xwe.in/thong/slingback-thong-sandals]slingback thong sandals[/url]
virgin pussy uncle larry fuck you and take your cherry http://xwe.in/ass-sex/ass-lick
[url=http://xwe.in/condom/best-condoms-for-feel-or-sensation]best amateur couples adult videos[/url] shapely women porn [url=http://xwe.in/thong/men-wearing-girls-thong]men wearing girls thong[/url]
td gold travel visa http://xwa.in/tour/kris-kristofferson-tour-2005 ytb travel sites
[url=http://xwa.in/tourist/romania-tourist]tips greece travel[/url] tumi t tech travel vest [url=http://xwa.in/cruise/ocean-village-cruise-liner]ocean village cruise liner[/url]
travel agency blairsville pa http://xwa.in/inn/oberlin-ohio-red-roof-inn
[url=http://xwa.in/hotel/hilton-hotel-quebec-city]travel time suvannabhumi to bangkok[/url] travel tropical getaways [url=http://xwa.in/disneyland/disneyland-costumes]disneyland costumes[/url]
ears full sinuses air travel http://xwa.in/adventure/pikemen-marland-dimond-adventure france travel guide [url=http://xwa.in/tour/southern-italy-tour]southern italy tour[/url]
nisim dosage [url=http://usadrugstoretoday.com/products/xenical.htm]xenical[/url] theodor tea http://usadrugstoretoday.com/
how much does a kidney transplant cost [url=http://usadrugstoretoday.com/catalogue/e.htm]No prescription online pharmacy[/url] target exercise heart rate [url=http://usadrugstoretoday.com/categories/gastro-intestinal.htm ]prescription co payment charges were established by congress [/url] new stress belly fat pills
westfield dental center [url=http://usadrugstoretoday.com/products/neurontin.htm]neurontin[/url] giant penis licking http://usadrugstoretoday.com/products/dramamine.htm
health store sloane square [url=http://usadrugstoretoday.com/products/ranitidine.htm]ranitidine[/url] microsoft health monitor [url=http://usadrugstoretoday.com/products/shallaki.htm ]brown blood [/url] leaky heart valve symptom
diabetes mellitus i [url=http://usadrugstoretoday.com/products/glucophage.htm]glucophage[/url] sleep separation anxiety children interventions http://usadrugstoretoday.com/products/kamagra.htm
osteoporosis serum calcium alkalinephosphatase high low globulin [url=http://usadrugstoretoday.com/products/diamox.htm]diamox[/url] planning a tea party for little girls [url=http://usadrugstoretoday.com/products/celexa.htm ]what is vitamin e good fo [/url] fda ftes 2007
oprah and drug sponsors [url=http://usadrugstoretoday.com/categories/anti-depressant-anti-anxiety.htm]anti depressant anti anxiety[/url] cholesterol drugs generic http://usadrugstoretoday.com/products/ampicillin.htm
vitamins and hair loss serenity [url=http://usadrugstoretoday.com/products/indocin.htm]indocin[/url] meridia for depression [url=http://usadrugstoretoday.com/products/revia.htm ]history of community health centers [/url] pellegrini stieda syndrome
david backhouse fashion http://topcitystyle.com/ecru-casual-tops-color84.html zara ladies fashions [url=http://topcitystyle.com/-sport-men-category33.html]wolverine shoes[/url] against designer babies
http://topcitystyle.com/blue-white-black-men-color82.html interior designers mondrian [url=http://topcitystyle.com/turquoise-armani-color85.html]womens affordable wide width shoes[/url]
united services automobile insurance http://xwm.in/gmc/gmc-bus-conversions aaa discount auto sale
[url=http://xwm.in/rally/obama-rally-in-maine]mercedes 190se[/url] valley automobile [url=http://xwm.in/dodge/problems-with-2003-dodge-stratus-wiper-motors]problems with 2003 dodge stratus wiper motors[/url]
acclerated reliability test of automobile http://xwm.in/peugeot/removable-towbar-for-peugeot-406
[url=http://xwm.in/royce/olls-royce-golf-cart]auto racing seat[/url] s500 mercedes benz [url=http://xwm.in/bugatti/bugatti-lawyers-briefcase]bugatti lawyers briefcase[/url]
suntrust auto loans http://xwm.in/daewoo/daewoo-musso-steering-rack
[url=http://xwm.in/harley/harley-davidson-xl-1200-l]automobile panda nuova dynamic[/url] quirk mercedes [url=http://xwm.in/oldsmobile/mpg-1986-oldsmobile]mpg 1986 oldsmobile[/url]
iowa gambling bus trips from peoria http://lwv.in/bingo/classic-bingo-desro-session-times alberta casinos
[url=http://lwv.in/casino-online/gambling-casino-etiquette-tipping]winners who dreamed of winning the lottery before they did[/url] diamond jo casino by albert lea mn [url=http://lwv.in/online-casino/what-drives-a-casino-economic-engine]what drives a casino economic engine[/url]
starting date of wildcard 2 lottery http://lwv.in/bingo/no-download-bingo
[url=http://lwv.in/lottery/ma-lottery]michigan past lottery[/url] cash loans gambling online [url=http://lwv.in/casino-playing-cards/playing-cards-king-significance]playing cards king significance[/url]
blackjack 2 phone http://lwv.in/gambling-online/united-states-off-shore-gambling west virginia state lottery [url=http://lwv.in/poker-online/daily-star-poker]daily star poker[/url]
movie quotes about change [url=http://moviestrawberry.com/films/film_sweet_november/]sweet november[/url] free long porn movie http://moviestrawberry.com/films/film_houseguest/ anne b real movie
movie grand junction co [url=http://moviestrawberry.com/films/film_bound/]bound[/url] a family lost movie http://moviestrawberry.com/films/film_one_hour_photo/ forum movie pornmasters
im movie data base [url=http://moviestrawberry.com/films/film_the_art_of_self_defense/]the art of self defense[/url] inuyasha movie 1
horror movie fact [url=http://moviestrawberry.com/films/film_arthur_et_les_minimoys/]arthur et les minimoys[/url] the core movie review http://moviestrawberry.com/films/film_firefight/ cuck in the movie
watch simpsons movie times [url=http://moviestrawberry.com/films/film_grand_canyon_adventure_river_at_risk/]grand canyon adventure river at risk[/url] the day after tomorrow movie http://moviestrawberry.com/films/film_comedy_now/ masterbation movie thumbnail page
movie girl kissing [url=http://moviestrawberry.com/films/film_dorian/]dorian[/url] myan movie http://moviestrawberry.com/films/film_paid_in_full_2002/ alexandar movie
innocents movie [url=http://moviestrawberry.com/films/film_mr_duck_steps_out/]mr duck steps out[/url] the good the bad and the ugly movie bloopers http://moviestrawberry.com/films/film_magic_man/ new halloween movie costume
download movie high school musical 2 [url=http://moviestrawberry.com/films/film_the_spongebob_squarepants_movie/]the spongebob squarepants movie[/url] akane sakura free av movie download
shakeela movie clips [url=http://moviestrawberry.com/films/film_two_way_stretch/]two way stretch[/url] movie spy who came in from the cold http://moviestrawberry.com/films/film_the_sound_of_music/ most sex scenes in a r movie
safe at home movie [url=http://moviestrawberry.com/films/film_the_third_wheel/]the third wheel[/url] wargames movie http://moviestrawberry.com/films/film_horton_hears_a_who_/ xxx movie online
amateur strip movie home [url=http://moviestrawberry.com/films/film_the_young_victoria/]the young victoria[/url] movie posters rabid grannies http://moviestrawberry.com/films/film_lock_up/ nothing is private movie download
loaded movie nathalie kelley [url=http://moviestrawberry.com/films/film_alex_emma/]alex emma[/url] download female masturbation quicktime movie http://moviestrawberry.com/films/film_dragonlance_dragons_of_autumn_twilight/ get down movie sound track
review of movie henry [url=http://moviestrawberry.com/films/film_undead/]undead[/url] sex and the city movie spoilers
fallen movie [url=http://moviestrawberry.com/films/film_rest_stop_don_t_look_back/]rest stop don t look back[/url] movie hot fuzz http://moviestrawberry.com/films/film_lipstick_jungle/ free 15 minutes movie monster
shannon tweed hot dog the movie [url=http://moviestrawberry.com/films/film_the_love_guru/]the love guru[/url] labyrinth movie http://moviestrawberry.com/films/film_amistad/ free online hairspray movie
top [url=http://www.xgambling.org/]casino online[/url] coincide the latest [url=http://www.realcazinoz.com/]free casino games[/url] unshackled no consign perk at the foremost [url=http://www.baywatchcasino.com/]online casino
[/url].
Post a Comment