JSFiddle - React, Tailwind, and code Playground

JavaScript

a="\n\
      '\\                   .  .                        |>18>>\n\
        \\              .         ' .                   |\n\
       O>>         .                 'o                |\n\
        \\       .                                      |\n\
        /\\    .                                        |\n\
       / /  .'                                         |\n\
 jgs^^^^^^^`^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\
.";

b="";
c=0;
d="";
for(i in a){
    if(i){
        if(a[i]==b){
           c++
        }
        else{
            if(c){
                //d+=b+c;
                d+="\\uD8"+("0"+b.charCodeAt(0).toString(16)).slice(-2)+"\\uDC"+("0"+c.toString(16)).slice(-2)
            }
           c=1;
           b=a[i];
        }
    }
}
console.log(d);