Cant get PHP to accept the POUND sign from a beautiful soup Python script -


So I have a script that pulls information from event webpage URL:

This is PHP The script is calling a Python script (part of its loop):

  $ {"tmp" $ I} = utf8_encode (exec ("Python myscrape.py $ {" EU ". $ I } "));   

This is the Python script that passes a URL:

  # - * - coding: UTF-8 - * - Import system URL = sys. Argv [1] # $ url = 'http://everguide.com .u / Melbourne / Event / 2012-Jul-14 / Color /' import urllib2 req = urllib2.Request (URL) response = urllib2.urlopen (req) Html = response.read () Beautiful soup soup = beautiful soup (html .decode ('utf-8') from Sundasubup import) soup.prettify () Import import to node for soup again. (All itemprop = "name"): n = '' .join (node.findAll (text = True)) Soup.findAll for node (itemprop = "url"): v = '' .join (node.findAll Text = True)) soup.findAll ("div", {"class": "time"}) for node: d = ''. For nodes (node.findAll (text = true) for soup Suit.Find all ("a", {"id": "ctl00_holderBody_ctl00_lnkCat"}): c = '' .join (node.findAll (text = true)) vu = v vu.encode ('utf-8', ' Xmlcharrefreplace ') re.escape (vu) print n, "|", d, "|", vu, "|", c   

which works really well, But only back to the vu or to the pipe - it can not go past!

UTF-8 encoding is set on all files, HTML and PHP.

When V variable has a special character, it breaks and closes if it does not have any special characters, then it works perfectly.

Expected output is:

  color | 14 July @ 7:30 pm 1000 a bend | Club & amp; Parties   

This ouutput can be viewed when running the script on the server (with the same python command), but on PHP - I cant get back the location string!

Please enter

vu. Encode return encoded string ... as you are not specifying the encoded results, it is just being thrown away what you have tried

vu = vu.encode ('Utf-8', 'xmlcharrefreplace')

You will also need to avoid this, it will be encoded by encoded Unicode.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -