当前位置:网站首页>Some Chinese character codes in the user privacy agreement are not standardized, which leads to the display of garbled codes on the web page. It needs to be found and handled uniformly
Some Chinese character codes in the user privacy agreement are not standardized, which leads to the display of garbled codes on the web page. It needs to be found and handled uniformly
2022-07-02 14:48:00 【Xu Tongbao】
<!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> Process the agreement file </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"> Source protocol :</div>
<!-- Copy the text of the agreement document on the flybook to the following div in -->
<div id="source" class="m-text">
One 、 individual ⼈ Information definition and scope
(⼀) individual ⼈ Information : Refers to electricity ⼦ Or other ⽅ Capable of being recorded independently or in combination with other information , Identify specific ⾃ however ⼈ Identity or reflect specific ⾃ however ⼈ Information about activities .
(⼆) individual ⼈ Sensitive information : Including ID number 、⼿ Machine number 、 individual ⼈⽣ Object identification information 、 silver ⾏ account number 、 Property information 、⾏ Track 、 Transaction information 、 Under 14 ( contain )⼉ Tong's one ⼈ Information, etc .
( 3、 ... and ) There are... Involved in this privacy policy ⼈ Information and ⼈ Sensitive information mainly includes :
1. Basic information of users : full name 、 Gender 、 individual ⼈ Phone number 、 Mailing address 、 grade 、 School, etc ;
2. ⽹ Network identity information : System account number ( Including the third ⽅)、IP Address / The type of browser 、 Telecom operators and passwords related to the foregoing 、 nickname 、 Head etc. ;
3. BesTV Cloud lesson makes ⽤ data : Browsing and clicking records 、 Software make ⽤ Record 、 adopt ⻨ g ⻛ transport ⼊ And so on ;
4. individual ⼈ often ⽤ Equipment information : Model of equipment 、 Operating system version 、 devices setting up 、 Unique device identifier and other software and hardware characteristic information ;
5. individual ⼈ Location information : Such as through GPS、 Bluetooth or WiFi Position information obtained by signal, etc ;
6. send ⽤ Third ⽅ Service production ⽣ The capital of ⾦ flow ⽔ Record .
</div>
<div class="m-reslut"> add to 【】 Find out the garbled words :</div>
<div id="result" class="m-text"></div>
<div class="m-reslut"> The garbled code has been eliminated :</div>
<div id="well-result" class="m-text"></div>
</div>
<script>
//const source = `01abA Use B people `
//const source = `“BesTV Cloud class ”`
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('##### First step #####')
console.log(' The number of garbled words ,:', count)
const unique = [...new Set(leftArr)]
console.log(' Garbled word array ( After weight removal )', unique.length, unique)
}
// Fill in the text that needs to be replaced , Regular expressions are garbled words
const doReplace = () => {
// '⽅', '⼀', '⼆', '⼦', '⼿', '⽣', '⾏', '⼉', '⽹', '⻨',
// '⻛', '⼊', '⾦', '⽔', '⽬', '⽌', '⼯', '⻚', '⾯', '⽀',
// '⽚', '⾥', '⼝', '⼤', '⼜', '⽆', '⼩', '⾼', '⻔', '⽽',
// '⾔', '⼒', '⼰', '⾜', '⾮', '⻓', '⽴', '⽇'
// '⼈', '⾃', '⽤', '⻅', '⽂'
let wellResult = source
.replace(/⽅/g, ' Fang ')
.replace(/⼀/g, ' One ')
.replace(/⼆/g, ' Two ')
.replace(/⼦/g, ' Son ')
.replace(/⼿/g, ' hand ')
.replace(/⽣/g, ' raw ')
.replace(/⾏/g, ' That's ok ')
.replace(/⼉/g, ' son ')
.replace(/⽹/g, ' network ')
.replace(/⻨/g, ' wheat ')
.replace(/⻛/g, ' wind ')
.replace(/⼊/g, ' Enter into ')
.replace(/⾦/g, ' gold ')
.replace(/⽔/g, ' water ')
.replace(/⽬/g, ' Objective ')
.replace(/⽌/g, ' stop ')
.replace(/⼯/g, ' work ')
.replace(/⻚/g, ' page ')
.replace(/⾯/g, ' Noodles ')
.replace(/⽀/g, ' the ')
.replace(/⽚/g, ' slice ')
.replace(/⾥/g, ' in ')
.replace(/⼝/g, ' mouth ')
.replace(/⼤/g, ' Big ')
.replace(/⼜/g, ' also ')
.replace(/⽆/g, ' nothing ')
.replace(/⼩/g, ' Small ')
.replace(/⾼/g, ' high ')
.replace(/⻔/g, ' door ')
.replace(/⽽/g, ' and ')
.replace(/⾔/g, ' said ')
.replace(/⼒/g, ' force ')
.replace(/⼰/g, ' Oneself ')
.replace(/⾜/g, ' foot ')
.replace(/⾮/g, ' Not ')
.replace(/⻓/g, ' Long ')
.replace(/⽴/g, ' state ')
.replace(/⽇/g, ' Japan ')
.replace(/⼈/g, ' people ')
.replace(/⾃/g, ' since ')
.replace(/⽤/g, ' use ')
.replace(/⻅/g, ' see ')
.replace(/⽂/g, ' writing ')
return wellResult
}
const step2 = () => {
let { result, count, leftArr } = findBug(doReplace(source))
const resultStr = result.join('')
document.getElementById('well-result').innerHTML = resultStr
console.log('##### The second step #####')
console.log(' The number of garbled words :', count, leftArr)
const wellUnique = [...new Set(leftArr)]
console.log(' Garbled word array ( After weight removal )', wellUnique.length, wellUnique)
}
const init = () => {
// The first step is to find out the garbled words
step1()
// Replace garbled text
step2()
}
init()
</script>
</body>
</html>
边栏推荐
- 复用和分用
- Database connection pool and data source
- taobao.trade.get( 获取单笔交易的部分信息),淘宝店铺订单接口,淘宝oAuth2.0接口,淘宝R2接口代码对接分享
- MQ tutorial | exchange (switch)
- How many knowledge points can a callable interface have?
- Talk about idempotent design
- The evolution process of the correct implementation principle of redis distributed lock and the summary of redison's actual combat
- taobao.trades.sold.get-查询卖家已卖出的交易数据(根据创建时间),淘宝店铺卖出订单查询API接口,淘宝R2接口,淘宝oAuth2.0交易接口代码分享
- ##51单片机实验之简易验证码发生器
- obsidian安装第三方插件——无法加载插件
猜你喜欢
Uniapp automated test learning
Stm32-dac Experiment & high frequency DAC output test
电脑怎么设置扬声器播放麦克风的声音
MQ tutorial | exchange (switch)
socket(套接字)与socket地址
Teamtalk source code analysis win client
[development environment] StarUML tool (download software | StarUML installation | StarUML creation project)
Development and design of animation surrounding mall sales website based on php+mysql
Chinese science and technology from the Winter Olympics (III): the awakening and evolution of digital people
【apipost】使用教程
随机推荐
由粒子加速器产生的反中子形成的白洞
Teamtalk source code analysis win client
[apipost] tutorial
实现一个多进程并发的服务器
【apipost】使用教程
obsidian安装第三方插件——无法加载插件
Full of knowledge points, how to use JMeter to generate encrypted data and write it to the database? Don't collect it quickly
Tip: SQL Server blocked the state 'openrowset/opendatasource' of component 'ad hoc distributed queries'
<口算练习机 方案开发原理图>口算练习机/口算宝/儿童数学宝/儿童计算器 LCD液晶显示驱动IC-VK1621B,提供技术支持
Fabric. JS manual bold text iText
Development and design of animation surrounding mall sales website based on php+mysql
Li Chuang EDA learning notes 15: draw border or import border (DXF file)
fatal: unsafe repository is owned by someone else 的解决方法
Obsidian installs third-party plug-ins - unable to load plug-ins
Uniapp automated test learning
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
Thoroughly master prototype__ proto__、 Relationship before constructor (JS prototype, prototype chain)
Slashgear shares 2021 life changing technology products, which are somewhat unexpected
Actual combat sharing of shutter screen acquisition
用户隐私协议有些汉字编码不规范导致网页显示乱码,需要统一找出来处理一下