Why doesn't this work?: Markup > Utilities > Translate...

8 views
Skip to first unread message

Govinda

unread,
Nov 14, 2008, 9:32:56 AM11/14/08
to BBEdit Talk
Isn't anyone using this feature? How?
I have a selection, like this string:
"remove"
(including the quote marks).
I use the command
Markup > Utilities > Translate...
which is set to
-text to HTML
-HTML entitites
-Name
-Selection Only

and when I hit the 'translate' button, then *nothing* happens.
I want it to replace my selection with
"remove"

What am I missing here?

Thanks!
-Govinda

Jim Correia

unread,
Nov 14, 2008, 9:42:02 AM11/14/08
to bbe...@googlegroups.com
On Nov 14, 2008, at 9:32 AM, Govinda wrote:

> Isn't anyone using this feature? How?
> I have a selection, like this string:
> "remove"
> (including the quote marks).
> I use the command
> Markup > Utilities > Translate...
> which is set to
> -text to HTML
> -HTML entitites
> -Name
> -Selection Only
>
> and when I hit the 'translate' button, then *nothing* happens.
> I want it to replace my selection with
> "remove"

Translate doesn't translate " -> &quote; because it is in general, not
necessary.

Why do you want to represent quotation marks in entity form?

Jim

Govinda

unread,
Nov 14, 2008, 3:54:31 PM11/14/08
to BBEdit Talk
when it becomes a value for a form <input>
for example.
-G

Jim Correia

unread,
Nov 14, 2008, 5:27:03 PM11/14/08
to bbe...@googlegroups.com
On Nov 14, 2008, at 3:54 PM, Govinda wrote:

>> Why do you want to represent quotation marks in entity form?
>

> when it becomes a value for a form <input>
> for example.

It is not currently possible to have the HTML Translate too
automatically encode double quotes.

If you use the HTML Markup tools (in this case the Input editor)
double quotes should automatically be encoded in your input. There is
bug which prevents this from happening in certain situations - I'll
fix it for a future release.

If you are typing code by hand, an even faster solution than typing
the entities would be to wrap your attribute value in single quotes.
For example

<input name="some_name" value='"some value"' />

(I'll log a feature request so we can consider offering purpose built
entity encoding tools which solve this need separate from the
translate utility.)

Jim

Dennis

unread,
Nov 14, 2008, 5:49:08 PM11/14/08
to bbe...@googlegroups.com
On Nov 14, 2008, at 2:27 PM, Jim Correia wrote:

>> when it becomes a value for a form <input>
>> for example.
>
> It is not currently possible to have the HTML Translate too
> automatically encode double quotes.

Govinda:

As a workaround you could use a Perl script to convert the current
selection to entities and save it as a Unix Filter in BBEdit. For
example, I use this script (saved to ~/Library/Application Support/
BBEdit/Unix Support/Unix Filters/Convert to HTML Entities.pl):

-----

#!/usr/bin/perl -w

use CGI;

while (<>)
{
print CGI::escapeHTML($_);
}

-----

Assign a nice keyboard shortcut (I like Control-Command-E) and you're
all set. Hope this helps.

-Dennis

Govinda

unread,
Nov 15, 2008, 12:02:30 AM11/15/08
to BBEdit Talk
> As a workaround you could use a Perl script to convert the current
> selection to entities and save it as a Unix Filter in BBEdit. For
> example,

Thank you guys both for your replies and time.

Jim I must have stumbled on one of those bug cases since I get
<input name=""test"" type="text" size="20" />
with the input button on the html tool pallette. But don't mind this
on my account;
this was not a huge hangup for me, just one of those many things that
it takes more time to fix (i.e. finally figure how to get it into a
keystroke) than to do the slow way yet one more time. I thought I'd
try and push this one through. ;-)

Dennis your reply opened up a whole new field for me where I have yet
to play at all (I've never written perl, and "Unix Filters in
BBEdit"?!) (what you Jim made possible with BBedit some time
ago ;-). I will try doing these very things you suggest soon, thanks!

-G

Robert A. Rosenberg

unread,
Nov 15, 2008, 12:05:27 AM11/15/08
to bbe...@googlegroups.com
At 17:27 -0500 on 11/14/2008, Jim Correia wrote about Re: Why doesn't
this work?: Markup > Utilities > Translate.:

>(I'll log a feature request so we can consider offering purpose built 
>entity encoding tools which solve this need separate from the
>translate utility.)

While you are at it, I'd like to suggest a 4th check box at the
bottom of the Format Menu Options area that would convert all Unicode
entries over u+00ff to encoded entries (like the translate does now)
WHEN the Charset is NOT UTF8/UTF16 and there are High Ascii
characters. Also, I would like to have a way of having any x80-x9F
characters converted to encoded (or Unicode if Charset=UTF=8) if
Charset is ISO-8859-1 (since they are ONLY valid for Windows-1252 and
should be replaced with their 8xxx Unicode values). This will handle
the use of non-ISO-8859-1 Characters which normally trigger the "MUST
SAVE AS UTF-8" error message.
--


Robert A. Rosenberg
RAR Programming Systems Ltd.
(845)-357-0931 - Home
(646)-479-1984 - Cell Phone
(646)-349-4025 - Fax

Oliver Boermans

unread,
Feb 15, 2009, 2:45:12 AM2/15/09
to bbe...@googlegroups.com
2008/11/15 Govinda <govinda.w...@gmail.com>:

>
> Isn't anyone using this feature? How?
> I have a selection, like this string:
> "remove"
> and when I hit the 'translate' button, then *nothing* happens.
> I want it to replace my selection with
> &quot;remove&quot;

Perhaps this will be of interest:
<http://daringfireball.net/projects/smartypants/>

Reply all
Reply to author
Forward
0 new messages