- 改行コードが異なる
- 前者はLF(改行)のみ
- 後者はLF(改行)CR(復帰)
- となる
https://jsbin.com/zarodixota/edit?html,js,console,output
"----------------"
97
10
98
10
10
99
10
10
100
10
"-----------------"
97
13
10
98
13
10
13
10
99
13
10
13
10
100
13
10
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<form name="test">
<textarea name="text1">
a
b
c
d
</textarea>
</form>
</body>
</html>
let form = document.forms["test"];
let text = form["text1"].value;
console.log("----------------");
for(let char of text){
console.log(char.charCodeAt());
}
let fd = new FormData(form);
console.log("-----------------");
for(let value of fd){
let str = value[1];
for(let char of str){
console.log(char.charCodeAt());
}
}
訂正
🙅♀️
改行コードが異なる
となる
🙆♀️
改行コードが異なる
となる