简体   繁体   中英

Javascript: Invalid Unicode escape sequence while storing accessing unicode

I am setting Fontawesome Icon codes in SELECT box and accessing on change event. On accessing I am getting error:

Invalid Unicode escape sequence

Code given below:

HTML

<select name="faicons" id="faicons" class="form-control selectpicker">
    <option value="0">Select</option>
    <option value="uF26E" class="fa fa-500px"> 500px</option>
    <option value="uF26E" class="fa fa-linkedin"> LinkedIn</option>
</select>

Javascript

function renderIcon(code) {
    var context = null;
    code = "F26E"
    var icon_code = "\u"+code;
    context = main_canvas.getContext('2d');
    context.font='32px FontAwesome';
    context.fillText(icon_code,20,75);
    context.fillText("My TEXT!", 140, 90);
}
["

Unicode escape sequences are only recognized if they're fully contained in a single string literal.<\/i>

I have same problem while add path in js file, then I added one more slash it working fine.

Error:

${dirname}\config\user_config

Solution:

${dirname}\\config\\user_config

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM