NetTalk Central

Author Topic: Redactor replaces <br/> with <br> and (sometimes) adds <13,10>'s  (Read 3096 times)

Stu

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
    • Email
Hi Folks,

Am messing about with a Redactor editor field, and have run into a couple of interesting things.

1. <br/> tags are replaced with <br>, which I wouldn't care about, but it causes an XML Parsing (mismatched tag) error when viewing as html.

2. A clean (straight html) string value can have a <13,10> added to it. I've only just discovered this, and am just about to try and work out why this is happening, but thought I'd mention it here in case someone else has had it.

Any thoughts?

Cheers.
Cheers,

Stu Andrews

Stu

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
    • Email
Re: Redactor replaces <br/> with <br> and (sometimes) adds <13,10>'s
« Reply #1 on: August 04, 2014, 08:28:04 PM »
** EDIT #1 **

Confirmed.

1. Open popup form with redactor field. Click save button.

Look at field value in notepad++ (first attached image), shows a <13,10> added.

2. Open popup form again, click on the save button.

Look at the new field value, <13,10> has been removed (second attached image).

** NOTE **

The </body> and </html> tags are added by me on saving of the form, they're not part of the Redactor edit field.

Am still investigating whether this manual addition of tags is the cause.

[attachment deleted by admin]
« Last Edit: August 04, 2014, 08:37:40 PM by Stu »
Cheers,

Stu Andrews

Stu

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
    • Email
Re: Redactor replaces <br/> with <br> and (sometimes) adds <13,10>'s
« Reply #2 on: August 04, 2014, 08:37:24 PM »
** EDIT #2 **

Looks like it wasn't <13,10> but <13><10>.

The following code in the ValidateRecord embed clears up the issue (and the <br> one also):

Code: [Select]
!* Any parsing on the Email Body value? *
str1.SetValue(p_web.GSV('loc:Email_Body'))
str1.Replace('<br>','<br/>')
str1.Remove('<13,10>')
str1.Remove('<13>')
str1.Remove('<10>')

I guess my worry is that if this is what Redactor does at all times, then if I've got it used throughout my system, is it contaminating data all over?
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: Redactor replaces <br/> with <br> and (sometimes) adds <13,10>'s
« Reply #3 on: August 04, 2014, 10:18:40 PM »
Hi Stu,

>> Looks like it wasn't <13,10> but <13><10>.

same thing. they're just 2 different ways of describing ascii values in a string.

>> A clean (straight html) string value can have a <13,10> added to it.

Carriage Returns, and LineFeeds (ie 13,10) have no meaning in html. They can be added or removed it makes no difference to the browser displaying the HTML.
the only way to make a CR/LF matter to HTML is to put it inside a <pre> tag.

>> The following code in the ValidateRecord embed clears up the issue

there is a method call,
string = p_web.HtmlToxHrml(String)
which converts some common html to xHtml (like <br> to <br/>)

With regard to the 13,10, I don't remove them like you do, but they have no effect, so are harmless either way.

Cheers
Bruce




Stu

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
    • Email
Re: Redactor replaces <br/> with <br> and (sometimes) adds <13,10>'s
« Reply #4 on: August 04, 2014, 10:35:26 PM »
Hi Bruce,

Thanks for the reply.

1. They might be the same thing, but they're not the same thing when you're trying to get rid of them with a stringtheory object. '<13,10>' is NOT '<13><10>'.

2. Okay, good to know. I wonder if they have any effect in email clients.

3. Cool, very cool. Will have to use it.
Cheers,

Stu Andrews

Stu

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
    • Email
Re: Redactor replaces <br/> with <br> and (sometimes) adds <13,10>'s
« Reply #5 on: August 04, 2014, 10:36:23 PM »
So Bruce,

If Nettalk is really big on XHTML .. Why does Redactor replace <br/> with <br>?
Cheers,

Stu Andrews

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: Redactor replaces <br/> with <br> and (sometimes) adds <13,10>'s
« Reply #6 on: August 04, 2014, 11:33:53 PM »
Hi Stu,
Does " the rest" of redactor funtion normally?
E.g I cannot add images. The buttom works, I can select an image but the result is that nothing happens.
Same happens when I select text to be come <h1>. The button works so I can select the header type. But nothing happens.

Cheers,
Rene Simons
Rene Simons
NT14.14

Stu

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
    • Email
Re: Redactor replaces <br/> with <br> and (sometimes) adds <13,10>'s
« Reply #7 on: August 05, 2014, 02:28:48 PM »
Hey Rene,

You're way ahead of me! I'm just on text editing at the moment :)

Haven't touched the buttons yet.
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11186
    • View Profile
Re: Redactor replaces <br/> with <br> and (sometimes) adds <13,10>'s
« Reply #8 on: August 06, 2014, 12:40:03 AM »
I think all you need to do for the moment Rene is turn off Immediate Validation on the text field and then it should work.

I'm investigating further.

Rene Simons

  • Hero Member
  • *****
  • Posts: 649
    • View Profile
Re: Redactor replaces <br/> with <br> and (sometimes) adds <13,10>'s
« Reply #9 on: August 06, 2014, 02:55:09 PM »
Ok, I 'll do that and see what happens.
In the meantime I wait.
Thanks,
Rene
Rene Simons
NT14.14