When I pass a file path, such as 'C:\u01\oracle\fmw_11114\data\proj\folder\name 09022014.txt, from java controller to a javascript script, it causes the error 'Expected hexadecimal Digit'.
This path is read from file-system and passed to the script directly and I can not escape the backslash '\' in the string before passing it to the script. Any ideas how to solve the problem?
if(document.getElementById('hdnA').value == 'ALR') {
alert('ERROR: ' + '${arch}' + ' file not found.')
}
The error message is a good indicator to what went wrong.
Unicode characters can be passed literally to a script using the format: \uXXXX (Where XXXX represent the code for the specific character).
Your path includes a folder whose name starts with U, so the path string contains the the literal control characters for literal Unicode character insertion (\u).
An easy workaround would be passing the file path with forward slashes instead:
'C:/u01/oracle/fmw_11114/data/proj/folder/name 09022014.txt'
I ran into the same issue with my Java application, which tried inserting a script dynamically with path values in the element. Changing my backslashes to forward slashes resolved the issue for me.
Salam! Use this regexp:
patt=/\\/g;
str = str.replace(patt,"\\\\")
this worked for me;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With