| Author |
Topic Search Topic Options
|
Marcvanu
Newbie
Joined: 13 February 2006
Location: Belgium
Status: Offline
Points: 19
|
Post Options
Thanks(0)
Quote Reply
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 ?
|
 |
WebWiz-Bruce
Admin Group
Web Wiz Developer
Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
|
Post Options
Thanks(0)
Quote Reply
Posted: 13 February 2006 at 2:03pm |
|
Could you please give more detail, such as the javascript error and when it happens
|
|
|
 |
Marcvanu
Newbie
Joined: 13 February 2006
Location: Belgium
Status: Offline
Points: 19
|
Post Options
Thanks(0)
Quote Reply
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.
|
 |
WebWiz-Bruce
Admin Group
Web Wiz Developer
Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
|
Post Options
Thanks(0)
Quote Reply
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.
|
|
|
 |
Marcvanu
Newbie
Joined: 13 February 2006
Location: Belgium
Status: Offline
Points: 19
|
Post Options
Thanks(0)
Quote Reply
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...
|
 |
WebWiz-Bruce
Admin Group
Web Wiz Developer
Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
|
Post Options
Thanks(0)
Quote Reply
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)
|
|
|
|
 |
Marcvanu
Newbie
Joined: 13 February 2006
Location: Belgium
Status: Offline
Points: 19
|
Post Options
Thanks(0)
Quote Reply
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.
|
 |
WebWiz-Bruce
Admin Group
Web Wiz Developer
Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
|
Post Options
Thanks(0)
Quote Reply
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 |
|
|
|
 |