NetTalk Central

Author Topic: Redactor saving apostrophes as ’  (Read 4861 times)

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Redactor saving apostrophes as ’
« on: March 26, 2014, 05:05:48 PM »
Hi Bruce/Folks,

NT7.last, Clarion 9.0.10376

Using the Redactor editor (love it) seems to save apostrophes as the ’ character into fields in the database (ie a Note field).

Looking it up (http://stackoverflow.com/questions/2477452/a-showing-on-page-instead-of) seems to indicate I need to change to UTF encoding, but pretty sure Nettalk should handle this okay?

Stu
Cheers,

Stu Andrews

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Redactor saving apostrophes as ’
« Reply #1 on: March 26, 2014, 09:10:58 PM »
Update: Have just noticed that when a certain kind of apostrophe, ’, (because there are different ones it seems) is used in any old field (at the moment, a plain text field), the apostrophe is changed to ’ on tabbing off the field.

Have site:nettalkcentral.com googled for "apostrophe" but couldn't find much .. Am thinking this has probably cropped up before.
Cheers,

Stu Andrews

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Redactor saving apostrophes as ’
« Reply #2 on: March 26, 2014, 09:12:42 PM »
More investigation .. It's not an apostrophe, it's a "left single quotation mark" according to http://www.ascii.cl/htmlcodes.htm.
Cheers,

Stu Andrews

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Redactor saving apostrophes as ’
« Reply #3 on: March 27, 2014, 02:24:09 PM »
Have got a favor to ask:

In Nettalk 8, can someone test on a regular TEXT field in a netwebform, if you copy and paste the below, and then tab off it, does the apostrophe get changed?

--

property’s

--
Cheers,

Stu Andrews

tglomb

  • Jr. Member
  • **
  • Posts: 79
    • View Profile
    • AObit Software
    • Email
Re: Redactor saving apostrophes as ’
« Reply #4 on: March 27, 2014, 02:49:34 PM »
If I copy from the website into a NT textbox it gets changed after tabbing out of the textbox. If I copy the same into Notepad then it remains the same.
Ciao

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Redactor saving apostrophes as ’
« Reply #5 on: March 27, 2014, 03:35:21 PM »
Much appreciated!

Am guessing Notepad formats it automatically (which is what I'd love Nettalk to do).
Cheers,

Stu Andrews

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Redactor saving apostrophes as ’
« Reply #6 on: March 28, 2014, 12:08:28 AM »
Hey Bruce, tell the truth .. You're avoiding this post right?

Old Props never get any coding cred.
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Redactor saving apostrophes as ’
« Reply #7 on: March 28, 2014, 01:39:20 AM »
Hi Stu,

There are a few things in play here.

That's a unicode character. chr(8217) if you're interested.

If your app is going to accept unicode characters (and no reason why it shouldn't) then make sure your Charset (Webserver / Advanced tab) is set to
'utf-8'

At the moment there is no Clarion unicode string type. With any luck that's coming, but it's not here yet. So you now have 2 choices;

Either save the string as unicode, without any transformation to Ascii or convert the character to something in the Ascii range before saving.

Storing as utf-8 can cause problems elsewhere - especially if you use the string on a report, or inspect the table with external tools etc.

Converting to ASCII is fine (set "Store as" to ASCII on the Webserver Advanced tab).

You will need either build 8.05, or 7.39, or you need to add the following 4 lines to NetWeb.Clw at the top of the NetWebServerWorker.UtfToAscii method;

  utfmap[8216] = 39  ! open single quote, changed to '
  utfmap[8217] = 39  ! close single quote, changed to '   
  utfmap[8220] = 34  ! open double quote, changed to "
  utfmap[8221] = 34  ! close double quote, changed to "     


This takes care of the single and double quotes - but of course there are many zillions of unicode chars out there, so this issue could arise again with another character. In the long run a Ustring data type will be a good thing (so encourage SoftVelocity to expedite that.)







Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Redactor saving apostrophes as ’
« Reply #8 on: March 28, 2014, 01:59:32 AM »
Thanks Bruce, will have a look, see what works.
Cheers,

Stu Andrews