当前位置:网站首页>用户隐私协议有些汉字编码不规范导致网页显示乱码,需要统一找出来处理一下
用户隐私协议有些汉字编码不规范导致网页显示乱码,需要统一找出来处理一下
2022-07-02 11:23:00 【徐同保】
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>处理协议文件</title>
<style>
.m-source {
font-size: 30px;
color: #f66f0c;
}
.m-reslut {
font-size: 30px;
color: green;
}
.m-text {
white-space: pre-wrap;
width: 100%;
}
</style>
</head>
<body>
<div>
<div class="m-source">源协议:</div>
<!-- 将飞书上的协议文件文字内容复制到下面的div里 -->
<div id="source" class="m-text">
一、个⼈信息定义及范围
(⼀)个⼈信息:指以电⼦或者其他⽅式记录的能够单独或与其他信息结合,识别特定⾃然⼈身份或者反映特定⾃然⼈活动情况的信息。
(⼆)个⼈敏感信息:包括身份证件号码、⼿机号码、个⼈⽣物识别信息、银⾏账号、财产信息、⾏踪轨迹、 交易信息、十四岁以下(含)⼉童的个⼈信息等。
(三)本隐私政策中涉及的个⼈信息及个⼈敏感信息主要包括:
1. 用户基本信息:姓名、性别、个⼈电话号码、收件地址、年级、学校等;
2. ⽹络身份标识信息:系统账号(含第三⽅)、IP地址/浏览器的类型、电信运营商及与前述有关的密码、昵称、头像等;
3. BesTV云课使⽤数据:浏览及点击记录、软件使⽤记录、通过⻨克⻛输⼊的内容等;
4. 个⼈常⽤设备信息:设备型号、操作系统版本、设备设置、唯一设备标识符等软硬件特征信息等;
5. 个⼈位置信息:如通过GPS、蓝牙或WiFi信号获得的位置信息等;
6. 使⽤第三⽅服务产⽣的资⾦流⽔记录。
</div>
<div class="m-reslut">添加【】找出乱码字:</div>
<div id="result" class="m-text"></div>
<div class="m-reslut">已经处理掉乱码:</div>
<div id="well-result" class="m-text"></div>
</div>
<script>
//const source = `01abA收用用B人`
//const source = `“BesTV云课”`
const source = document.getElementById('source').innerHTML
const findBug = (value) => {
const start = 0x4e00
const end = 0x9fa5
let result = []
let count = 0
let leftArr = []
;[...value].forEach((item) => {
const current = item.charCodeAt()
//console.log(item, current)
if (
0x2000 <= current &&
current <= 0x2fff &&
current !== 8220 &&
current != 8221
) {
result.push(`【${item}】`)
count++
leftArr.push(item)
} else {
result.push(item)
}
})
return { result, count, leftArr }
}
const step1 = () => {
let { result, count, leftArr } = findBug(source)
const resultStr = result.join('')
document.getElementById('result').innerHTML = resultStr
console.log('#####第一步#####')
console.log('乱码字字数,:', count)
const unique = [...new Set(leftArr)]
console.log('乱码字数组(去重后)', unique.length, unique)
}
//填写需要替换的文字,正则表达式里是乱码的文字
const doReplace = () => {
// '⽅', '⼀', '⼆', '⼦', '⼿', '⽣', '⾏', '⼉', '⽹', '⻨',
// '⻛', '⼊', '⾦', '⽔', '⽬', '⽌', '⼯', '⻚', '⾯', '⽀',
// '⽚', '⾥', '⼝', '⼤', '⼜', '⽆', '⼩', '⾼', '⻔', '⽽',
// '⾔', '⼒', '⼰', '⾜', '⾮', '⻓', '⽴', '⽇'
// '⼈', '⾃', '⽤', '⻅', '⽂'
let wellResult = source
.replace(/⽅/g, '方')
.replace(/⼀/g, '一')
.replace(/⼆/g, '二')
.replace(/⼦/g, '子')
.replace(/⼿/g, '手')
.replace(/⽣/g, '生')
.replace(/⾏/g, '行')
.replace(/⼉/g, '儿')
.replace(/⽹/g, '网')
.replace(/⻨/g, '麦')
.replace(/⻛/g, '风')
.replace(/⼊/g, '入')
.replace(/⾦/g, '金')
.replace(/⽔/g, '水')
.replace(/⽬/g, '目')
.replace(/⽌/g, '止')
.replace(/⼯/g, '工')
.replace(/⻚/g, '页')
.replace(/⾯/g, '面')
.replace(/⽀/g, '支')
.replace(/⽚/g, '片')
.replace(/⾥/g, '里')
.replace(/⼝/g, '口')
.replace(/⼤/g, '大')
.replace(/⼜/g, '又')
.replace(/⽆/g, '无')
.replace(/⼩/g, '小')
.replace(/⾼/g, '高')
.replace(/⻔/g, '门')
.replace(/⽽/g, '而')
.replace(/⾔/g, '言')
.replace(/⼒/g, '力')
.replace(/⼰/g, '己')
.replace(/⾜/g, '足')
.replace(/⾮/g, '非')
.replace(/⻓/g, '长')
.replace(/⽴/g, '立')
.replace(/⽇/g, '日')
.replace(/⼈/g, '人')
.replace(/⾃/g, '自')
.replace(/⽤/g, '用')
.replace(/⻅/g, '见')
.replace(/⽂/g, '文')
return wellResult
}
const step2 = () => {
let { result, count, leftArr } = findBug(doReplace(source))
const resultStr = result.join('')
document.getElementById('well-result').innerHTML = resultStr
console.log('#####第二步#####')
console.log('乱码字字数:', count, leftArr)
const wellUnique = [...new Set(leftArr)]
console.log('乱码字数组(去重后)', wellUnique.length, wellUnique)
}
const init = () => {
//第一步找出乱码文字
step1()
//替换乱码文字
step2()
}
init()
</script>
</body>
</html>
边栏推荐
- 检查密码
- There is no solution to the decryption error of the remote user 'sa' and the service master password mapped from the remote server 'to the local user' (null) /sa '
- Method of creating linked server for cross server data access
- 数据库连接池和数据源
- threejs的控制器 立方體空間 基本控制器+慣性控制+飛行控制
- Federated Search: all requirements in search
- OpenCV调用USB摄像头的点滴
- freemarker的使用
- taobao. logistics. dummy. Send (no logistics delivery processing) interface, Taobao store delivery API interface, Taobao order delivery interface, Taobao R2 interface, Taobao oau2.0 interface
- Daily learning 3
猜你喜欢
Quick analysis: easy to share the Internet
< schematic diagram of oral arithmetic exercise machine program development> oral arithmetic exercise machine / oral arithmetic treasure / children's math treasure / children's calculator LCD LCD driv
Tip: SQL Server blocked the state 'openrowset/opendatasource' of component 'ad hoc distributed queries'
[apipost] tutorial
Design and implementation of car query system based on php+mysql
<口算练习机 方案开发原理图>口算练习机/口算宝/儿童数学宝/儿童计算器 LCD液晶显示驱动IC-VK1621B,提供技术支持
YOLOv3&YOLOv5输出结果说明
报错:npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Development and design of animation surrounding mall sales website based on php+mysql
##51单片机实验之简易验证码发生器
随机推荐
由粒子加速器产生的反中子形成的白洞
taobao. trade. memo. Add (add remarks to a transaction) interface, Taobao store flag insertion interface, Taobao order flag insertion API interface, oauth2.0 interface
<口算练习机 方案开发原理图>口算练习机/口算宝/儿童数学宝/儿童计算器 LCD液晶显示驱动IC-VK1621B,提供技术支持
mongodb的认识
php链表创建和遍历
Why can't browsers read JSX?
MQ tutorial | exchange (switch)
【apipost】使用教程
Bit by bit of OpenCV calling USB camera
OpenCV调用USB摄像头的点滴
Certik released the defi security report in 2021, disclosing key data of industry development (PDF download link attached)
fatal: unsafe repository is owned by someone else 的解决方法
每日学习2
Tip: SQL Server blocked the state 'openrowset/opendatasource' of component 'ad hoc distributed queries'
3. Function pointers and pointer functions
PTA question bank== > complex four operations, one for one, examination seat number (7-73)
taobao.logistics.dummy.send( 无需物流发货处理 )接口,淘宝店铺发货API接口,淘宝订单发货接口,淘宝r2接口,淘宝oAu2.0接口
Find the maximum inscribed circle of the contour
Quick analysis: easy to share the Internet
taobao.trades.sold.get-查询卖家已卖出的交易数据(根据创建时间),淘宝店铺卖出订单查询API接口,淘宝R2接口,淘宝oAuth2.0交易接口代码分享