Actually what is it UTF-8?
UTF-8 (unicode transformation format) is a character encoding that is commonly used in web development to
represent text using a sequence of bytes.
It is designed to be compatible with ASCII, which means that ASCII character can be represented using a single byte,
while characters from other scripts, such as chinese etc, require
multiple bytes.
UTF-8 is widely used in web
development becuase it allows developers to support a wide range of characters
and scripts without requiring complex encoding schemes or special
handling for different language.
It's support most modern web
browsers and web servers.
Web browser how can understand UTF-8?
Web browser can understand UTF-8 encoding because it is the
default character encoding used by the world wide web.
When a web
page is loaded in a browser, the browser looks for a character encoding
declaration in the document's metadata, such as the
HTML <meta> element or the HTTP "Content-Type" header. If no explicit encoding is specified, the browser assumes that the
content is encoded in UTF-8 by default.
How we can implement UTF-8 in web development and convert in to UTF-8 in computer language?
First we implement a HTML From for take user input!! so lets start
with the HTML coding.
Let's say you are building a web form that
allows users to input their name and email address. You want to ensure that
the form can handle names and email addresses from around the world,
Here's an example HTML form that uses UTF-8 encoding:
<form action="submit-form.php" method="post">
<label for="name">Name:</label>
<input
type="text" name="name" id="name">
<label
for="email">Email:</label>
<input type="email"
name="email" id="email">
<button
type="submit">Submit</button>
</form>
In the PHP script that handles the form submission
(submit-form.php), we can use the $_POST superglobal to access the form data.
Because we are using UTF-8 encoding, any non-ASCII characters in the form data
will be correctly represented:
$name = $_POST['name'];
$email = $_POST['email'];
<!DOCTYPE html> <html> <head> <title>UTF-8 encoding </title> <meta charset="UTF-8"> </head> <style> .form-css { top: 50%; left:50%; transform: translate(-50%, -50%); position: absolute; border: 2px solid black; padding: 30px; } </style> <body> <form action="form.php" class="form-css" method="post"> <h2 style="text-align:center">Hacking Truth</h2> <label for="name">Name:</label> <input type="text" name="name" id="name"> <label for="email">Email:</label> <input type="email" name="email" id="email"> <button type="submit" name="submit">Submit</button> </form> <?php if(isset($_POST['submit'])) { $name = $_POST['name']; $email = $_POST['email']; echo "<h4>Your Name is $name</h4>"; echo "<h4>Your Email ID is $email</h4>"; } ?> </body> </html>
NOTE - View it in desktop mode to see it in good resolution.
Read Also -
Network Primer Series with Binary to Decimal, Dec to Bin, Dec to Hex etc
Now, we take user's output like "atul" and convert it into
ASCII and binary too, then computer understands our language.
Here are the steps to follow:
Look up the ASCII code for each character in the
text. You can find an ASCII table online, but in general, the
ASCII codes for uppercase and lowercase letters, digits, and most punctuation
marks are the same as their Unicode code points.
In this case, the ASCII codes for the characters in "atul" are:
a = 97
t = 116
u = 117
l = 108
PHP Code of Decimal To Binary Converter
<?php echo "<h1>Hacking Truth</h1>"; echo "<br />"; $a = decbin(97); echo "The Decimal value of 97 is : $a"; echo "<br />"; $b = decbin(116); echo "The Decimal value of 116 is : $b"; echo "<br />"; $c = decbin(117); echo "The Decimal value of 117 is : $c"; echo "<br />"; $d = decbin(108); echo "The Decimal value of 108 is : $d"; echo "<br />"; ?>
Computer Be Like - Thank You Buddy :-)
Disclaimer
All tutorials are for informational and educational purposes only and have been made using our own routers, servers, websites and other vulnerable free resources. we do not contain any illegal activity. We believe that ethical hacking, information security and cyber security should be familiar subjects to anyone using digital information and computers. Hacking Truth is against misuse of the information and we strongly suggest against it. Please regard the word hacking as ethical hacking or penetration testing every time this word is used. We do not promote, encourage, support or excite any illegal activity or hacking.