PDA

View Full Version : Auto replace characters with html entities


media_man
12-03-2008, 09:37 AM
Hi Folks,

I use Dreamweaver only in code view to develop my web stuff. Often I get long text files to insert in ISO encoded websites. Then I have to replace german Umlaute ""with "ö" or "" with "Ü" and so on...

Is there a possibility to create a macro in dreamweaver, where I can insert all my rules: if you find this > replace it with this...

I know this function from some other programms (Komodo Edit,...) and hope somebody has a tip for me, how I can realise it in DW.

Thanks and Cheers,
media_man

d a v e
12-03-2008, 12:58 PM
use 'find and replace'?!

media_man
12-03-2008, 01:06 PM
Thanks for the answer but you didn't understand, what I want:

I know "find and replace" - to solve my problem I have to use it 1000 times

What I want is a marco with x-Finde'n'Replaces

I make one click and DW makes Find'n'Replace "" + Find'n'Replace "" + ...

domedia
12-03-2008, 03:04 PM
No, it wont be a 1000 times but it's going to take you 10 minutes to replace all of them.

This is your only option since your text is already encoded in a different character set.

media_man
12-03-2008, 03:17 PM
Unbelievable that a commercial (and expensive) product like dreamweaver doesn't support such easy things...

What's with the panel behavior? Isn't there a way to write own behaviors?

domedia
12-03-2008, 04:01 PM
Yes, you can write your own behaviors!

media_man
12-03-2008, 05:27 PM
And how?

do you have a simple example or a link with a description?

domedia
12-03-2008, 05:40 PM
Look in the help files and also look in the development center.
There's tons of behaviors and plugins available at the exchange, so people are extending DW all the time.

But again search and replace a handful of characters is only going to take you max 10 minutes.

media_man
12-03-2008, 05:52 PM
"But again search and replace a handful of characters is only going to take you max 10 minutes."

Exact - and I do it very often - so why should I spend 10minutes, when it can be done in 1.sec / 1 click

Ich searched for an extension which helps me - but I didn't find one - that's the reason why I startet this thread.

I tryed to create a behavior and found on the Adobe Website: Dreamweaver Scripting > Create Behavior
I installed it and started with it. It's not easy to use and and so I clicked on the help link: http://www.extending-dreamweaver.com/

What is coming: url is missing - great :-(

domedia
12-03-2008, 08:46 PM
O.k, maybe I don't don't understand your scenario, but it hasn't really been explained either. This sounds pretty simple to me:

1. Use 10 minutes to search replace.
2. Immediately start saving/storing/creating/presenting your data with the right characterset so you don't have to go back to #1.

Cary
12-03-2008, 11:52 PM
I use Dreamweaver only in code view to develop my web stuff.

When pasting textual content such as you describe, you should use design view. Then DW automatically converts to entities any characters not supported by the encoding being used.

media_man
12-04-2008, 03:20 PM
@Cary
Good Tip - thanks

-------------------------
@Dom
What it tryed to do, is to create a macro like this one
(which I wrote for komodo edit)

// Macro recorded on Mon Jun 02 2008 16:28:49 GMT+0200
komodo.assertMacroVersion(2);
if (komodo.view) { komodo.view.setFocus() };
Find_ReplaceAllInMacro(window, 0, '', 'Ü', true, 0, 0, false, false);
Find_ReplaceAllInMacro(window, 0, '', 'ü', true, 0, 0, false, false);
Find_ReplaceAllInMacro(window, 0, '', 'Ö', true, 0, 0, false, false);
Find_ReplaceAllInMacro(window, 0, '', 'ö', true, 0, 0, false, false);
Find_ReplaceAllInMacro(window, 0, '', 'Ä', true, 0, 0, false, false);
Find_ReplaceAllInMacro(window, 0, '', 'ä', true, 0, 0, false, false);
Find_ReplaceAllInMacro(window, 0, '', '&acecil;', true, 0, 0, false, false);

When I paste Code, Text, whatever in my files - I make one Click and the marco replaces everything automaticlly. The benefit with a selfmade macro is, that I can expand it like:

Find_ReplaceAllInMacro(window, 0, '<br>', '<br />', true, 0, 0, false, false);

domedia
12-04-2008, 05:36 PM
I still think this could be easily solved by using the correct characterset.
Notice how the German characters have no issue to be displayed correctly in your posts in this thread? But I'm by no means an expert on it.