c77fb700创建于 2025年1月16日历史提交
/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

export const REPLACEMENT_KEYS = [
  '"',
  '\\',
  '\t',
  '\b',
  '\n',
  '\r',
  '\f',
  '\u0000',
  '\u0001',
  '\u0002',
  '\u0003',
  '\u0004',
  '\u0005',
  '\u0006',
  '\u0007',
  '\u000b',
  '\u000e',
  '\u000f',
  '\u0010',
  '\u0011',
  '\u0012',
  '\u0013',
  '\u0014',
  '\u0015',
  '\u0016',
  '\u0017',
  '\u0018',
  '\u0019',
  '\u001a',
  '\u001b',
  '\u001c',
  '\u001d',
  '\u001e',
  '\u001f',
  '\u2028',
  '\u2029'
]

export const REPLACEMENT_VALUES = [
  "\\\"",
  "\\\\",
  "\\t",
  "\\b",
  "\\n",
  "\\r",
  "\\f",
  '\\u0000',
  '\\u0001',
  '\\u0002',
  '\\u0003',
  '\\u0004',
  '\\u0005',
  '\\u0006',
  '\\u0007',
  '\\u000b',
  '\\u000e',
  '\\u000f',
  '\\u0010',
  '\\u0011',
  '\\u0012',
  '\\u0013',
  '\\u0014',
  '\\u0015',
  '\\u0016',
  '\\u0017',
  '\\u0018',
  '\\u0019',
  '\\u001a',
  '\\u001b',
  '\\u001c',
  '\\u001d',
  '\\u001e',
  '\\u001f',
  '\\u2028',
  '\\u2029'
]

export const HTML_SAFE_REPLACEMENT_KEYS = [
  '"',
  '\\',
  '\t',
  '\b',
  '\n',
  '\r',
  '\f',
  '\u0000',
  '\u0001',
  '\u0002',
  '\u0003',
  '\u0004',
  '\u0005',
  '\u0006',
  '\u0007',
  '\u000b',
  '\u000e',
  '\u000f',
  '\u0010',
  '\u0011',
  '\u0012',
  '\u0013',
  '\u0014',
  '\u0015',
  '\u0016',
  '\u0017',
  '\u0018',
  '\u0019',
  '\u001a',
  '\u001b',
  '\u001c',
  '\u001d',
  '\u001e',
  '\u001f',
  '\u2028',
  '\u2029',
  '<',
  '>',
  '&',
  '=',
  '\''
]

export const HTML_SAFE_REPLACEMENT_VALUES = [
  "\\\"",
  "\\\\",
  "\\t",
  "\\b",
  "\\n",
  "\\r",
  "\\f",
  '\\u0000',
  '\\u0001',
  '\\u0002',
  '\\u0003',
  '\\u0004',
  '\\u0005',
  '\\u0006',
  '\\u0007',
  '\\u000b',
  '\\u000e',
  '\\u000f',
  '\\u0010',
  '\\u0011',
  '\\u0012',
  '\\u0013',
  '\\u0014',
  '\\u0015',
  '\\u0016',
  '\\u0017',
  '\\u0018',
  '\\u0019',
  '\\u001a',
  '\\u001b',
  '\\u001c',
  '\\u001d',
  '\\u001e',
  '\\u001f',
  '\\u2028',
  '\\u2029',
  "\\u003c",
  "\\u003e",
  "\\u0026",
  "\\u003d",
  "\\u0027"
]

export const REPLACEMENT_CHARS = {
  '"': "\\\"",
  '\\': "\\\\",
  '\t': "\\t",
  '\b': "\\b",
  '\n': "\\n",
  '\r': "\\r",
  '\f': "\\f",
  '\u0000': '\\u0000',
  '\u0001': '\\u0001',
  '\u0002': '\\u0002',
  '\u0003': '\\u0003',
  '\u0004': '\\u0004',
  '\u0005': '\\u0005',
  '\u0006': '\\u0006',
  '\u0007': '\\u0007',
  '\u000b': '\\u000b',
  '\u000e': '\\u000e',
  '\u000f': '\\u000f',
  '\u0010': '\\u0010',
  '\u0011': '\\u0011',
  '\u0012': '\\u0012',
  '\u0013': '\\u0013',
  '\u0014': '\\u0014',
  '\u0015': '\\u0015',
  '\u0016': '\\u0016',
  '\u0017': '\\u0017',
  '\u0018': '\\u0018',
  '\u0019': '\\u0019',
  '\u001a': '\\u001a',
  '\u001b': '\\u001b',
  '\u001c': '\\u001c',
  '\u001d': '\\u001d',
  '\u001e': '\\u001e',
  '\u001f': '\\u001f',
  '\u2028': '\\u2028',
  '\u2029': '\\u2029'
};

export const HTML_SAFE_REPLACEMENT_CHARS = {
  '"': "\\\"",
  '\\': "\\\\",
  '\t': "\\t",
  '\b': "\\b",
  '\n': "\\n",
  '\r': "\\r",
  '\f': "\\f",
  '\u0000': '\\u0000',
  '\u0001': '\\u0001',
  '\u0002': '\\u0002',
  '\u0003': '\\u0003',
  '\u0004': '\\u0004',
  '\u0005': '\\u0005',
  '\u0006': '\\u0006',
  '\u0007': '\\u0007',
  '\u000b': '\\u000b',
  '\u000e': '\\u000e',
  '\u000f': '\\u000f',
  '\u0010': '\\u0010',
  '\u0011': '\\u0011',
  '\u0012': '\\u0012',
  '\u0013': '\\u0013',
  '\u0014': '\\u0014',
  '\u0015': '\\u0015',
  '\u0016': '\\u0016',
  '\u0017': '\\u0017',
  '\u0018': '\\u0018',
  '\u0019': '\\u0019',
  '\u001a': '\\u001a',
  '\u001b': '\\u001b',
  '\u001c': '\\u001c',
  '\u001d': '\\u001d',
  '\u001e': '\\u001e',
  '\u001f': '\\u001f',
  '\u2028': '\\u2028',
  '\u2029': '\\u2029',
  '<': "\\u003c",
  '>': "\\u003e",
  '&': "\\u0026",
  '=': "\\u003d",
  '\'': "\\u0027"
};