code: public static String encodeLine(String string, boolean bResourceListBundle)
      {
          if (string == null)
              return string;
          for (int i = 0; i < string.length(); i++)
          {
              if (((string.charAt(i) == '\"') || (string.charAt(i) == '\\'))
               || ((!bResourceListBundle) && (string.charAt(i) == ':')))
              {   // must preceed these special characters with a "\"
                  string = string.substring(0, i) + "\\" + string.substring(i);
                  i++;
              }
              else if (string.charAt(i) > 127)
              {
                  String strHex = "0123456789ABCDEF";
                  String strOut = "\\u";
                  strOut += strHex.charAt((string.charAt(i) & 0xF000) >> 12);
                  strOut += strHex.charAt((string.charAt(i) & 0xF00) >> 8);
                  strOut += strHex.charAt((string.charAt(i) & 0xF0) >> 4);
                  strOut += strHex.charAt(string.charAt(i) & 0xF);
                  string = string.substring(0, i) + strOut + string.substring(i + 1);
                  i = i + strOut.length() - 1;
              }
          }
          return string;
      }
docs: Encode the utf-16 characters in this line to escaped java strings.