VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: serazoo on January 20, 2021, 03:51:00 AM

Title: "Customer note" textarea saves ASCII characters in database
Post by: serazoo on January 20, 2021, 03:51:00 AM
Hello VM community :)

I'm using Joomla 3.9.23 and VirtueMart 3.8.6 10373
The database table structure is in UTF-8
In VM config "invoice/email" I've chosen the font "Free mono (UTF-8 Unicode)"
But the same 3 ASCII characters are saved in many "customer notes" in database

I've read a couple of posts a str_replace is an option for replacing those ASCII
Is there a way to intercept them and replace, before they get saved to DB?

&#13 : return
&#10 : line Feed (Lf)
&#39 : apostrophe '

The "Return" and "Line feed" can be relpaced by a space
How to formulate a script ? In what file and where to insert it?
Thank you for your time :)

I found  :-\
<h3><?php ($this->keyword = vRequest::uword ('keyword', "", ' ,#39,-,+,.,_,#,/')); ?></h3>
$name = str_replace('&#39;', ' ', $product->product_name);
Title: Re: "Customer note" textarea saves ASCII characters in database
Post by: serazoo on February 22, 2021, 02:55:42 AM
GJC Web Design, a VM contributer hinted this could be keyboard related. A couple of posts years ago, here in the Forum had the same issue using French language, LIKE ME!

The question is : how does VM handle keyboard and language differently than Joomla?

-All Joomla inputs with an apostrophe ' are fine in Database
-All VM inputs : child products, person's name and customer's note in cart... apostrophe '  result with an ASCII code &#39  in database

Can someone please shed a light on this?
I'm sure a fix can help many foreign VM users :)
Cheers!
Title: Re: "Customer note" textarea saves ASCII characters in database
Post by: sirius on February 22, 2021, 10:08:48 AM
Hi,
I can confirm this and already open a topic on this too, because of custom titles of categories or products:
https://forum.virtuemart.net/index.php?topic=145580

You can have a look on this one too:
https://forum.virtuemart.net/index.php?topic=140498
Title: Re: "Customer note" textarea saves ASCII characters in database
Post by: serazoo on February 22, 2021, 14:07:13 PM
Thx Sirius, I've read all posts on this.. I did use the Alt 0146 for the apostrophe when I first saw the problem in my child products.

I can deal with child products myself.. but the most annoying thing is Customer's note, I honestly can tell all my clients to Alt the 3 characters : &#13   &#10   &#39  I receive in Customer's note.

There must be a better solution, I can't believe we are the only 2 with this issue  :-\

Thx everyone for your time :)