Jump to content

php characters


bartekd
 Share

Recommended Posts

I am doing something with an API in another software, and I need to get the source of a html file and put it in a PHP file. I have everything working as intended, but I keep coming accross characters that PHP doesn't like, and it stops there. Is there some script I can use to catch all the characters that PHP doesn't like? This is part of how I am doing it now, and I keep adding this same line every time I come accross a character that makes the script stop. FYI $sHTML is the source code of the page.

$sHTML = StringReplace($sHTML, '"', "'")
$sHTML = StringReplace($sHTML, '“', "'")
$sHTML = StringReplace($sHTML, '’', "'")
$sHTML = StringReplace($sHTML, '”', "'")
$sHTML = StringReplace($sHTML, 'à', "a")
$sHTML = StringReplace($sHTML, 'â', "a")
$sHTML = StringReplace($sHTML, 'ä', "a")
$sHTML = StringReplace($sHTML, 'è', "e")
$sHTML = StringReplace($sHTML, 'ê', "e")
$sHTML = StringReplace($sHTML, 'é', "e")
$sHTML = StringReplace($sHTML, 'ë', "e")
$sHTML = StringReplace($sHTML, 'î', "i")
Link to comment
Share on other sites

Doesn't seem to work for me. I still see letters like é etc... Do I need to format it differently before using that?

$IEFile = "c:test"

Local $oIE = _IECreate($IEFile & ".htm")

Local $sHTML = _IEDocReadHTML($oIE)

_IEQuit($oIE)

StringRegExpReplace($sHTML, '[^²&"''(-)=°+~#{[|`^@]}$*?,:!.%w]', "")

Edited by bartekd
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...