Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

Catastrophic failure Unexpected method call sequence. 0x8000ffff (-2147418113)., ksh lock a file, [unixODBC][Driver Manager]Driver's SQLAllocHandle on SQL_HANDLE_DBC failed, sed: -e expression #1, char 1: unterminated address regex, procmail + change subject, w2ksp4.exe download, /proc/kallsyms format, sqldatasource dal, wwwxxxenden, convert raid5 to raid 10 mdadm

Links

XODOX
Impressum

#1: Converting funky characters

Posted on 2010-03-29 02:05:50 by Skip Evans

Hey all,

What's the best way to filter/convert characters that don't
translate properly from say news stories to HTML?

For example, I have a form that people cut and paste the lead
in paragraph from news stories they want to link to from their
sites to the original. And of course things like long dashes,
double quotes, single quotes, etc, always translate is wacky
unprintables when they are rendered, and the user needs to
edit them to replace them with standard characters.

Is there way to filter this text through a function that will
convert them to web friendly chars?

Thanks,
Skip

--
====================================
Skip Evans
PenguinSites.com, LLC
503 S Baldwin St, #1
Madison WI 53703
608.250.2720
http://penguinsites.com
------------------------------------
Those of you who believe in
telekinesis, raise my hand.
-- Kurt Vonnegut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message

#2: Re: Converting funky characters

Posted on 2010-03-29 03:21:33 by Nilesh Govindrajan

On 03/29/2010 05:35 AM, Skip Evans wrote:
> Hey all,
>
> What's the best way to filter/convert characters that don't
> translate properly from say news stories to HTML?
>
> For example, I have a form that people cut and paste the lead
> in paragraph from news stories they want to link to from their
> sites to the original. And of course things like long dashes,
> double quotes, single quotes, etc, always translate is wacky
> unprintables when they are rendered, and the user needs to
> edit them to replace them with standard characters.
>
> Is there way to filter this text through a function that will
> convert them to web friendly chars?
>
> Thanks,
> Skip
>

PCRE is your best friend for such problems.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मà¥Âरा भारत महान !
मम भारत: महतà¥Âतम भवतॠ!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message

#3: Re: Converting funky characters

Posted on 2010-03-29 03:52:02 by solo hsi

i think you just need function urldecode()....

On Mon, Mar 29, 2010 at 8:05 AM, Skip Evans <skip@bigskypenguin.com> wrote:
> Hey all,
>
> What's the best way to filter/convert characters that don't
> translate properly from say news stories to HTML?
>
> For example, I have a form that people cut and paste the lead
> in paragraph from news stories they want to link to from their
> sites to the original. And of course things like long dashes,
> double quotes, single quotes, etc, always translate is wacky
> unprintables when they are rendered, and the user needs to
> edit them to replace them with standard characters.
>
> Is there way to filter this text through a function that will
> convert them to web friendly chars?
>
> Thanks,
> Skip
>
> --
> ==================== =====
============
> Skip Evans
> PenguinSites.com, LLC
> 503 S Baldwin St, #1
> Madison WI 53703
> 608.250.2720
> http://penguinsites.com
> ------------------------------------
> Those of you who believe in
> telekinesis, raise my hand.
> =A0-- Kurt Vonnegut
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--=20
solo(xzyyyy@gmail.com)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message

#4: Re: Converting funky characters

Posted on 2010-03-29 03:54:23 by Nilesh Govindrajan

On 03/29/2010 07:22 AM, solo hsi wrote:
> i think you just need function urldecode()....
>
> On Mon, Mar 29, 2010 at 8:05 AM, Skip Evans<skip@bigskypenguin.com> wrote:
>> Hey all,
>>
>> What's the best way to filter/convert characters that don't
>> translate properly from say news stories to HTML?
>>
>> For example, I have a form that people cut and paste the lead
>> in paragraph from news stories they want to link to from their
>> sites to the original. And of course things like long dashes,
>> double quotes, single quotes, etc, always translate is wacky
>> unprintables when they are rendered, and the user needs to
>> edit them to replace them with standard characters.
>>
>> Is there way to filter this text through a function that will
>> convert them to web friendly chars?
>>
>> Thanks,
>> Skip
>>
>> --
>> ====================================
>> Skip Evans
>> PenguinSites.com, LLC
>> 503 S Baldwin St, #1
>> Madison WI 53703
>> 608.250.2720
>> http://penguinsites.com
>> ------------------------------------
>> Those of you who believe in
>> telekinesis, raise my hand.
>> -- Kurt Vonnegut
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
>

No, only urlencode() won't do the job. He's saying more about the long
spaces and quotes, etc.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मà¥Âरा भारत महान !
मम भारत: महतà¥Âतम भवतॠ!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message

#5: Re: Converting funky characters

Posted on 2010-03-29 09:52:44 by Ashley Sheridan

--=-WPh0ABDWTmj2/u6CgEZc
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, 2010-03-29 at 07:24 +0530, Nilesh Govindarajan wrote:

> On 03/29/2010 07:22 AM, solo hsi wrote:
> > i think you just need function urldecode()....
> >
> > On Mon, Mar 29, 2010 at 8:05 AM, Skip Evans<skip@bigskypenguin.com> wr=
ote:
> >> Hey all,
> >>
> >> What's the best way to filter/convert characters that don't
> >> translate properly from say news stories to HTML?
> >>
> >> For example, I have a form that people cut and paste the lead
> >> in paragraph from news stories they want to link to from their
> >> sites to the original. And of course things like long dashes,
> >> double quotes, single quotes, etc, always translate is wacky
> >> unprintables when they are rendered, and the user needs to
> >> edit them to replace them with standard characters.
> >>
> >> Is there way to filter this text through a function that will
> >> convert them to web friendly chars?
> >>
> >> Thanks,
> >> Skip
> >>
> >> --
> >> ==================== ===3D=
=============3D
> >> Skip Evans
> >> PenguinSites.com, LLC
> >> 503 S Baldwin St, #1
> >> Madison WI 53703
> >> 608.250.2720
> >> http://penguinsites.com
> >> ------------------------------------
> >> Those of you who believe in
> >> telekinesis, raise my hand.
> >> -- Kurt Vonnegut
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
> >
> >
>=20
> No, only urlencode() won't do the job. He's saying more about the long=20
> spaces and quotes, etc.
>=20
> --=20
> Nilesh Govindarajan
> Site & Server Administrator
> www.itech7.com
> मà¥Âरा भारत=
महान !
> मम भारत: मà=A4=
¹à¤¤à¥Âतà¤=AE भवतà=A5=
=81 !
>=20


I wrote something that converts these characters, which you'll most
often find when copying text from MS Office:

http://www.ashleysheridan.co.uk/coding_php_remove_ms_crap.ph p

The second argument to the function just tells it to remove all the
hidden meta tags that MS Office chucks into text that you copy into a
rich text box in a web page, as this can really mess up how the content
is displayed in a web browser.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-WPh0ABDWTmj2/u6CgEZc--

Report this message

#6: Re: Converting funky characters

Posted on 2010-03-29 10:51:59 by Ashley Sheridan

--=-tXB3+jiomFgRmwgwsrFj
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Mon, 2010-03-29 at 14:25 +0530, Nilesh Govindarajan wrote:

> On 03/29/2010 01:22 PM, Ashley Sheridan wrote:
> > On Mon, 2010-03-29 at 07:24 +0530, Nilesh Govindarajan wrote:
> >> On 03/29/2010 07:22 AM, solo hsi wrote:
> >> > i think you just need function urldecode()....
> >> >
> >> > On Mon, Mar 29, 2010 at 8:05 AM, Skip Evans<skip@bigskypenguin.com =
<mailto:skip@bigskypenguin.com>> wrote:
> >> >> Hey all,
> >> >>
> >> >> What's the best way to filter/convert characters that don't
> >> >> translate properly from say news stories to HTML?
> >> >>
> >> >> For example, I have a form that people cut and paste the lead
> >> >> in paragraph from news stories they want to link to from their
> >> >> sites to the original. And of course things like long dashes,
> >> >> double quotes, single quotes, etc, always translate is wacky
> >> >> unprintables when they are rendered, and the user needs to
> >> >> edit them to replace them with standard characters.
> >> >>
> >> >> Is there way to filter this text through a function that will
> >> >> convert them to web friendly chars?
> >> >>
> >> >> Thanks,
> >> >> Skip
> >> >>
> >> >> --
> >> >> ==================== ===
==============
> >> >> Skip Evans
> >> >> PenguinSites.com, LLC
> >> >> 503 S Baldwin St, #1
> >> >> Madison WI 53703
> >> >> 608.250.2720
> >> >> http://penguinsites.com
> >> >> ------------------------------------
> >> >> Those of you who believe in
> >> >> telekinesis, raise my hand.
> >> >> -- Kurt Vonnegut
> >> >>
> >> >> --
> >> >> PHP General Mailing List (http://www.php.net/)
> >> >> To unsubscribe, visit:http://www.php.net/unsub.php
> >> >>
> >> >>
> >> >
> >> >
> >> >
> >>
> >> No, only urlencode() won't do the job. He's saying more about the long
> >> spaces and quotes, etc.
> >>
> >> --
> >> Nilesh Govindarajan
> >> Site& Server Administrator
> >> www.itech7.com <http://www.itech7.com>
> >> मà¥Âरा भारà=
¤¤ महान !
> >> मम भारत:मà=
¤¹à¤¤à¥Âतम भवतà=
¥ !
> >>
> >
> > I wrote something that converts these characters, which you'll most
> > often find when copying text from MS Office:
> >
> > http://www.ashleysheridan.co.uk/coding_php_remove_ms_crap.ph p
> >
> > The second argument to the function just tells it to remove all the
> > hidden meta tags that MS Office chucks into text that you copy into a
> > rich text box in a web page, as this can really mess up how the content
> > is displayed in a web browser.
> >
> > Thanks,
> > Ash
> > http://www.ashleysheridan.co.uk
> >
> >
>=20
> Nice one. But not of use to me. I use geshi on my site, so cannot use=20
> WYSIWYG editors. Instead I've BBCode and WikiCreole (PEAR Wiki) input=20
> formats.
>=20
> --=20
> Nilesh Govindarajan
> Site & Server Administrator
> www.itech7.com
> मà¥Âरा भारत=
महान !
> मम भारत: मà=A4=
¹à¤¤à¥Âतà¤=AE भवतà=A5=
=81 !
>=20


It's not just for wysiwyg editors, that's just the second part of the
function. The first does just what you asked for.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--=-tXB3+jiomFgRmwgwsrFj--

Report this message

#7: Re: Converting funky characters

Posted on 2010-03-29 10:55:20 by Nilesh Govindrajan

On 03/29/2010 01:22 PM, Ashley Sheridan wrote:
> On Mon, 2010-03-29 at 07:24 +0530, Nilesh Govindarajan wrote:
>> On 03/29/2010 07:22 AM, solo hsi wrote:
>> > i think you just need function urldecode()....
>> >
>> > On Mon, Mar 29, 2010 at 8:05 AM, Skip Evans<skip@bigskypenguin.com <mailto:skip@bigskypenguin.com>> wrote:
>> >> Hey all,
>> >>
>> >> What's the best way to filter/convert characters that don't
>> >> translate properly from say news stories to HTML?
>> >>
>> >> For example, I have a form that people cut and paste the lead
>> >> in paragraph from news stories they want to link to from their
>> >> sites to the original. And of course things like long dashes,
>> >> double quotes, single quotes, etc, always translate is wacky
>> >> unprintables when they are rendered, and the user needs to
>> >> edit them to replace them with standard characters.
>> >>
>> >> Is there way to filter this text through a function that will
>> >> convert them to web friendly chars?
>> >>
>> >> Thanks,
>> >> Skip
>> >>
>> >> --
>> >> ====================================
>> >> Skip Evans
>> >> PenguinSites.com, LLC
>> >> 503 S Baldwin St, #1
>> >> Madison WI 53703
>> >> 608.250.2720
>> >> http://penguinsites.com
>> >> ------------------------------------
>> >> Those of you who believe in
>> >> telekinesis, raise my hand.
>> >> -- Kurt Vonnegut
>> >>
>> >> --
>> >> PHP General Mailing List (http://www.php.net/)
>> >> To unsubscribe, visit:http://www.php.net/unsub.php
>> >>
>> >>
>> >
>> >
>> >
>>
>> No, only urlencode() won't do the job. He's saying more about the long
>> spaces and quotes, etc.
>>
>> --
>> Nilesh Govindarajan
>> Site& Server Administrator
>> www.itech7.com <http://www.itech7.com>
>> मà¥Âरा भारत महान !
>> मम भारत:महतà¥Âतम भवतॠ!
>>
>
> I wrote something that converts these characters, which you'll most
> often find when copying text from MS Office:
>
> http://www.ashleysheridan.co.uk/coding_php_remove_ms_crap.ph p
>
> The second argument to the function just tells it to remove all the
> hidden meta tags that MS Office chucks into text that you copy into a
> rich text box in a web page, as this can really mess up how the content
> is displayed in a web browser.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>

Nice one. But not of use to me. I use geshi on my site, so cannot use
WYSIWYG editors. Instead I've BBCode and WikiCreole (PEAR Wiki) input
formats.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मà¥Âरा भारत महान !
मम भारत: महतà¥Âतम भवतॠ!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message

#8: Re: Converting funky characters

Posted on 2010-03-29 10:59:21 by Nilesh Govindrajan

On 03/29/2010 02:21 PM, Ashley Sheridan wrote:
> On Mon, 2010-03-29 at 14:25 +0530, Nilesh Govindarajan wrote:
>> On 03/29/2010 01:22 PM, Ashley Sheridan wrote:
>> > On Mon, 2010-03-29 at 07:24 +0530, Nilesh Govindarajan wrote:
>> >> On 03/29/2010 07:22 AM, solo hsi wrote:
>> >> > i think you just need function urldecode()....
>> >> >
>> >> > On Mon, Mar 29, 2010 at 8:05 AM, Skip Evans<skip@bigskypenguin.com <mailto:skip@bigskypenguin.com> <mailto:skip@bigskypenguin.com>> wrote:
>> >> >> Hey all,
>> >> >>
>> >> >> What's the best way to filter/convert characters that don't
>> >> >> translate properly from say news stories to HTML?
>> >> >>
>> >> >> For example, I have a form that people cut and paste the lead
>> >> >> in paragraph from news stories they want to link to from their
>> >> >> sites to the original. And of course things like long dashes,
>> >> >> double quotes, single quotes, etc, always translate is wacky
>> >> >> unprintables when they are rendered, and the user needs to
>> >> >> edit them to replace them with standard characters.
>> >> >>
>> >> >> Is there way to filter this text through a function that will
>> >> >> convert them to web friendly chars?
>> >> >>
>> >> >> Thanks,
>> >> >> Skip
>> >> >>
>> >> >> --
>> >> >> ====================================
>> >> >> Skip Evans
>> >> >> PenguinSites.com, LLC
>> >> >> 503 S Baldwin St, #1
>> >> >> Madison WI 53703
>> >> >> 608.250.2720
>> >> >> http://penguinsites.com
>> >> >> ------------------------------------
>> >> >> Those of you who believe in
>> >> >> telekinesis, raise my hand.
>> >> >> -- Kurt Vonnegut
>> >> >>
>> >> >> --
>> >> >> PHP General Mailing List (http://www.php.net/)
>> >> >> To unsubscribe, visit:http://www.php.net/unsub.php
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >> >
>> >>
>> >> No, only urlencode() won't do the job. He's saying more about the long
>> >> spaces and quotes, etc.
>> >>
>> >> --
>> >> Nilesh Govindarajan
>> >> Site& Server Administrator
>> >> www.itech7.com <http://www.itech7.com> <http://www.itech7.com>
>> >> मà¥Âरा भारत महान !
>> >> मम भारत:महतà¥Âतम भवतॠ!
>> >>
>> >
>> > I wrote something that converts these characters, which you'll most
>> > often find when copying text from MS Office:
>> >
>> > http://www.ashleysheridan.co.uk/coding_php_remove_ms_crap.ph p
>> >
>> > The second argument to the function just tells it to remove all the
>> > hidden meta tags that MS Office chucks into text that you copy into a
>> > rich text box in a web page, as this can really mess up how the content
>> > is displayed in a web browser.
>> >
>> > Thanks,
>> > Ash
>> > http://www.ashleysheridan.co.uk
>> >
>> >
>>
>> Nice one. But not of use to me. I use geshi on my site, so cannot use
>> WYSIWYG editors. Instead I've BBCode and WikiCreole (PEAR Wiki) input
>> formats.
>>
>> --
>> Nilesh Govindarajan
>> Site& Server Administrator
>> www.itech7.com <http://www.itech7.com>
>> मà¥Âरा भारत महान !
>> मम भारत:महतà¥Âतम भवतॠ!
>>
>
> It's not just for wysiwyg editors, that's just the second part of the
> function. The first does just what you asked for.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>

I didn't ask anything in this topic. It was Skip Evans the thread starter.

--
Nilesh Govindarajan
Site & Server Administrator
www.itech7.com
मà¥Âरा भारत महान !
मम भारत: महतà¥Âतम भवतॠ!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message

#9: Re: Converting funky characters

Posted on 2010-03-29 14:33:01 by Al

On 3/28/2010 8:05 PM, Skip Evans wrote:
> Hey all,
>
> What's the best way to filter/convert characters that don't
> translate properly from say news stories to HTML?
>
> For example, I have a form that people cut and paste the lead
> in paragraph from news stories they want to link to from their
> sites to the original. And of course things like long dashes,
> double quotes, single quotes, etc, always translate is wacky
> unprintables when they are rendered, and the user needs to
> edit them to replace them with standard characters.
>
> Is there way to filter this text through a function that will
> convert them to web friendly chars?
>
> Thanks,
> Skip
>

Here's how I handle the problem:

//region***** Translate table for dumb Windows chars when user pastes from Word;
function strips all >160

$win1252ToPlainTextArray = array(
chr(130) => ',',
chr(131) => '',
chr(132) => ',,',
chr(133) => '...',
chr(134) => '+',
chr(135) => '',
chr(139) => '<',
chr(145) => '\'',
chr(146) => '\'',
chr(147) => '"',
chr(148) => '"',
chr(149) => '*',
chr(150) => '-',
chr(151) => '-',
chr(155) => '>',
chr(160) => ' ',
);
//endregion

function cleanWin1252Text($str, $win1252ToPlainTextArray)
{
$str = strtr($str, $win1252ToPlainTextArray);
$str = trim($str);
$patterns = array('%[\x7F-\x81]%', '%[\x83]%', '%[\x87-\x8A]%',
'%[\x8C-\x90]%', '%[\x98-\xff]%');

return preg_replace($patterns, '', $str); //Strip
}




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Report this message