使用非拉丁字母的html占位符(Using html placeholder with non latin letters)

编程入门 行业动态 更新时间:2024-10-25 06:27:39
使用非拉丁字母的html占位符(Using html placeholder with non latin letters)

我正在使用placerholder=""来向用户显示他们必须翻译的单词: <input id="ha_1" placeholder="안녕하세요" type="text">韩语单词안녕하세요在chrome中显示完美,但却被搞砸了Firefox和Edge(两者都是最新版本)。 它看起来像这样:

有没有办法直接解决这个问题,还是有解决方法?

I am using placerholder="" like this to show the users which word they have to translate: <input id="ha_1" placeholder="안녕하세요" type="text"> The Korean word 안녕하세요 displays perfectly in chrome, but gets messed up by Firefox and Edge (both newest version). It looks like this:

Any way to fix this directly or is there a workaround for that?

最满意答案

您必须在html代码中定义Character Encoding类型。

什么是字符编码?

ASCII是第一个字符编码标准(也称为字符集)。 ASCII定义了可在互联网上使用的127种不同的字母数字字符:数字(0-9),英文字母(AZ)和一些特殊字符,如! $ + - ()@ <>。

ANSI(Windows-1252)是原始的Windows字符集,支持256种不同的字符代码。

ISO-8859-1是HTML 4的默认字符集。此字符集还支持256种不同的字符代码。

由于ANSI和ISO-8859-1非常有限,因此默认字符编码在HTML5中更改为UTF-8。

UTF-8(Unicode)几乎涵盖了世界上所有的字符和符号。

有关更多信息,请参阅此处

请在<head>标记内使用以下元标记。

<meta charset="UTF-8">

完整的例子。

<!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">
  <title>Character Encoding</title>

</head>

<body>
  <h1>안녕하세요</h1>
  <input id="ha_1" placeholder="안녕하세요" type="text">
</body>

</html> 
  
 

You have to define Character Encoding type inside of your html code.

What is Character Encoding?

ASCII was the first character encoding standard (also called character set). ASCII defined 127 different alphanumeric characters that could be used on the internet: numbers (0-9), English letters (A-Z), and some special characters like ! $ + - ( ) @ < > .

ANSI (Windows-1252) was the original Windows character set, with support for 256 different character codes.

ISO-8859-1 was the default character set for HTML 4. This character set also supported 256 different character codes.

Because ANSI and ISO-8859-1 were so limited, the default character encoding was changed to UTF-8 in HTML5.

UTF-8 (Unicode) covers almost all of the characters and symbols in the world.

for more information refer here.

Please use as following meta tag inside of your <head> tag.

<meta charset="UTF-8">

complete example.

<!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">
  <title>Character Encoding</title>

</head>

<body>
  <h1>안녕하세요</h1>
  <input id="ha_1" placeholder="안녕하세요" type="text">
</body>

</html> 
  
 

更多推荐

本文发布于:2023-08-07 07:56:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1462943.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:拉丁字母   html   placeholder   latin   letters

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!