Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Special character
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum LockedSpecial character

 Post Reply Post Reply Page  12>
Author
Marcvanu View Drop Down
Newbie
Newbie


Joined: 13 February 2006
Location: Belgium
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marcvanu Quote  Post ReplyReply Direct Link To This Post Topic: Special character
    Posted: 13 February 2006 at 2:00pm
I have a small problem when writing in french. The character ASCII 39 is coorupting the javascript code. How could I by pass the problem ?
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2006 at 2:03pm
Could you please give more detail, such as the javascript error and when it happens
Back to Top
Marcvanu View Drop Down
Newbie
Newbie


Joined: 13 February 2006
Location: Belgium
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marcvanu Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2006 at 2:22pm
I do not get an error. Actually when the code is uploaded into my Access database, all the characters following the famous character (I do not type it here) ASCII 39 is not taken neither the characters ASCII 39 itself. I know that this character is used in Javacsript language and I suscpect this is the cause of the problem.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2006 at 2:55pm
Javascript would not be the issue here.

It sounds more like a browser encoding issue.

Try changing the page encoding for the RTE and see if that fixes the issue. You should file a file called 'browser_page_encoding_inc.asp' that shopuld help you do this.
Back to Top
Marcvanu View Drop Down
Newbie
Newbie


Joined: 13 February 2006
Location: Belgium
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marcvanu Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2006 at 3:19pm
Well, I am not sure because if I uncomment Western European ISO or Unicode UTF-8 it does not change anything. But I realised that if I type twice teh famous character, one is saved not the second one. Here is an example in french:
L'exemple, it will return in the RTE_editor this L
If I write
L''exemple, it will return L'exemple and that is correct.
Strange...
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2006 at 3:31pm
If you type an example into the demo RTE with the ' in it, then it works without any issues.

This then suggests that the issue is with your code.

If you are saving to a database the character ' in SQL means the end of a string.

To prevent SQL injections from hackers and to stop this issue if you are using an SQL INSERT statement then you need to escape the quote character by replacing it with 2 quotes ''

input = Replace(input, "'", "''", 1, -1, 1)

Back to Top
Marcvanu View Drop Down
Newbie
Newbie


Joined: 13 February 2006
Location: Belgium
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marcvanu Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2006 at 3:52pm
Actually, in my scripts I use the following function:
function formatForDb(input)
 dim tempStr 
 tempStr=input
 if isNull(tempStr)=false then
 ' replace to avoid DB errors
  tempStr = replace(tempStr,"/"," ")
  tempStr = replace(tempStr,"'","''")
  tempStr = replace(tempStr,"''''","''")
  tempStr = replace(tempStr,"''''''","''")
  tempStr = replace(tempStr,"''''''''","''")
  tempStr = replace(tempStr,"""","""")
 end if
 formatForDb = tempStr
 
end function
It works fine in my other forms. Therefore my surprise here because I thought it should also work wthe RTE.
I don't understand why.
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 13 February 2006 at 4:22pm
The only line of any use in that lot is:-

tempStr = replace(tempStr,"'","''")


The rest won't do a thing to help with your SQL.

Here's a better one that I have refined over the years:-

'Format SQL Query funtion
Private Function formatSQLInput(ByVal strInputEntry)

    'Remove malisous charcters from sql
    strInputEntry = Replace(strInputEntry, """", "", 1, -1, 1)
    strInputEntry = Replace(strInputEntry, "'", "''", 1, -1, 1)
    strInputEntry = Replace(strInputEntry, "[", "[", 1, -1, 1)
    strInputEntry = Replace(strInputEntry, "]", "]", 1, -1, 1)

    'Return
    formatSQLInput = strInputEntry
End Function

Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.