0

I have a string like :

var a = " Hello \u0153 " 

when I console.log(a) I get

" Hello œ"

What I want is to have " Hello \u0153 "

I know if I can convert the string to " Hello \\u0153 " I will get what I want, but I am not able to convert the single slash to double slash, because anytime I try to perform any string functions, they are performed on " Hello œ "

Example fiddle

I have looked at the question : How to print literal unicode string in Javascript?

but the accepted answer does not work for strings which have ASCII characters written as Unicode , for example it will display \u0050 as P instead of \u0050 also, it will convert characters like œ to their unicode values, although it does not appear as such in the source string.

Community
  • 1
  • 1
gaurav5430
  • 12,934
  • 6
  • 54
  • 111

0 Answers0