-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnonlatin.html
59 lines (51 loc) · 1.65 KB
/
nonlatin.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Encoding non-Latin characters</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<style type="text/css" rel="stylesheet">
body {font-family: Verdana, Geneva, Arial, Helvetica}
</style>
</head>
<body>
<div id="app1">
<h1>GS1 Scan4Transport : encoding non-Latin characters</h1>
<p><b>Input:</b> a company name or street address (possibly containing non-Latin characters)</p>
<input type="text" v-model="input" style="width: 80%; float:left;"><span sstyle="float:right;"><input type="button" value="Demo" @click="demo"><input type="button" value="Clear" @click="clear"></span>
<p>Input was <input type="text" v-model="inputCount" readonly style="color: #666666;"> characters</p>
<br/>
<br/>
<p><b>Output:</b> the same value after percent-encoding (and use of '+' as an alternative for %20 for space)</p>
<input type="text" v-model="output" style="width: 80%;"><br/>
<p>Requires <input type="text" v-model="charCount" readonly style="background-color: #FFFFCC; font-weight: 700; font-size: 1.2em;"> characters</p>
<script language="javascript">
let input="";
var app1 = new Vue({
el: "#app1",
data : {
input: input,
},
computed : {
output: function() {
return encodeURIComponent(this.input).replace(/\%20/g,"+");
},
charCount : function() {
return this.output.length;
},
inputCount : function() {
return this.input.length;
}
},
methods : {
clear: function() {
this.input="";
},
demo : function() {
this.input="Königstraße 329";
}
}
});
</script>
</body>
</html>