Bug, char count, chars are cut off at the end if CRLF used | Support Questions | Support Forum

A A A

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Bug, char count, chars are cut off at the end if CRLF used
February 8, 2017
2:27 am
Curiosity
Member
Members
Forum Posts: 21
Member Since:
January 24, 2017
sp_UserOfflineSmall Offline

Posted a testcase here.

Entered a text with a few paragraphs and “..43210987654321” at the end until “0 chars left” showed up, see also screenshot of editing window included in testcase.

When publishing the post, some chars at the end are cut off, as you can see in testcase result. Same happens in a local install with AWPCP 3.7.4-dev-5, WP 4.7.2

editing.pngImage Enlargerresult.pngImage Enlarger

Please advise, thanks.

sp_PlupAttachments Attachments
February 8, 2017
11:25 am
AWPCP Support
Moderator
Members

Moderators
Forum Posts: 4332
Member Since:
September 4, 2013
sp_UserOfflineSmall Offline

Hi Curiosity,

Thank you for catching this one up. I’ll check with our programmer with regards to this. I’d get back to you as soon as I can.

February 8, 2017
12:23 pm
kerdezo
Member
Members
Forum Posts: 74
Member Since:
June 9, 2016
sp_UserOfflineSmall Offline

HI,@Curiosity

Do you have any text (say 8 chars) in the “Ad title” section?

February 8, 2017
2:48 pm
Curiosity
Member
Members
Forum Posts: 21
Member Since:
January 24, 2017
sp_UserOfflineSmall Offline

@kerdezo: No, the bug is caused by CRLF (new lines).

February 8, 2017
5:17 pm
Nat.
New Member
Members
Forum Posts: 1
Member Since:
February 8, 2017
sp_UserOfflineSmall Offline

Hi,

New on here. Its a great plug in and I have been singing its praises for a while now to many. However, tonight it stopped working and I have had to deactivate and remove it from my menu. I just hope I haven’t lost all my classifieds! Help!

February 9, 2017
11:15 am
AWPCP Support
Moderator
Members

Moderators
Forum Posts: 4332
Member Since:
September 4, 2013
sp_UserOfflineSmall Offline

Hi Nat,

You should have created a new thread for your concern.

Could you give us some more details on what happened? Some screenshots should help.

Which version of WP and AWPCP are you using?

February 9, 2017
4:23 pm
Curiosity
Member
Members
Forum Posts: 21
Member Since:
January 24, 2017
sp_UserOfflineSmall Offline

Counter when posting an ad counts newlines different than saving routine.

This bug is currently a showstopper for customer, please fix soon.

Here is the fix for awpcp_utf8_strlen() and awpcp_utf8_substr() etc.

http://tech.mybuilder.com/managing-newlines-and-unicode-within-javascript-and-php/#newline-solution
February 10, 2017
4:57 am
Curiosity
Member
Members
Forum Posts: 21
Member Since:
January 24, 2017
sp_UserOfflineSmall Offline

Did some code analysis and added a fix via a filter we found in get_posted_details() and which is also documented here.

Code posted to pastebin, the forum here unfortunately can’t handle backslash escapes..

Still wondering why a bug like this one was not identified earlier…

February 10, 2017
11:41 pm
AWPCP Support
Moderator
Members

Moderators
Forum Posts: 4332
Member Since:
September 4, 2013
sp_UserOfflineSmall Offline

Hi Curiosity,

CRLF characters count as characters, so it looks like you have “less”. A workaround is just to increase the character count slightly to work around this. It looks like you got it figured out on your end. Thanks for sharing it to the community.

February 11, 2017
5:13 am
Curiosity
Member
Members
Forum Posts: 21
Member Since:
January 24, 2017
sp_UserOfflineSmall Offline

As already described, we know and expect that CRLF counts as character.

The problem is, AWPCP backwards counter in browser (Javascript) counts each CRLF as one character while AWPCP backend saving routine (PHP) counts each CRFL as two character.

That’s why characters are cut of at end of description, one for every occurence of CRFL. Clearly a bug, the technical background about this is explained well at above linked mybuilder site.

The given “increase count slightly workaround” is of no use, sorry.

The code at pastebin removes the CR from CRLF before AWPCP checks the field length. AWPCP backend code then will see only LF and count only one character when saving and nothing gets cut off.

February 14, 2017
11:42 pm
AWPCP Support
Moderator
Members

Moderators
Forum Posts: 4332
Member Since:
September 4, 2013
sp_UserOfflineSmall Offline

Hi Curiosity,

We’ve received your emails on this as well. We’ll evaluate the solution and see if it’s the best way to solve it and integrate into a future release.

Forum Timezone: America/Denver

Most Users Ever Online: 163

Currently Online:
18 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Johnny B: 140

godie: 120

laburke: 94

NAIN KHAN: 93

salvig67: 84

kerdezo: 74

rude: 72

purplepaula: 72

WAYTOBAYWTB52: 71

gery: 71

Member Stats:

Guest Posters: 27

Members: 36407

Moderators: 2

Admins: 2

Forum Stats:

Groups: 1

Forums: 4

Topics: 6404

Posts: 28998

Newest Members:

a, Conrad Lopez, Chandra De Maistre, Lawrence Barreiro, Lionel Keister, Lyda Simpkinson, Roland Corkill, Maple Greenfield, Gia Hood, Tammi Hardie

Moderators: awpcp: 7530, AWPCP Support: 4332

Administrators: wpengine: 0, awpcp: 297

Skip to toolbar