Form value encoding in PHP - html

I would like to send out a value in a PHP form like this:
<input type="hidden" name="item_name" value="Car">
And I would like to specify the value is in UTF-8...
What steps do I have to do?

Put this in the header of your page:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
This will tell the browser to submit the characters in UTF-8 encoding.

You'll have to put this in your head-tag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Add this line of code after the <head> tag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<?= utf8_encode($the_var) ?> should achieve what you need.

Related

On the web page, place a link to the txt file and specify the encoding of the file as utf-8

Now the code is:
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<span lang="en-us">txt - </span>
How to insert charset="utf-8" attribute?
You should declare the whole document as UTF-8 with a charset command.
Add this between <head> and </head>:
<meta charset="utf-8"/>

og:title, description and image

i'm currently going a thumbnails generator for my site and maybe other people can use it so what this does is to generate a html file and that file get instant uploaded to the webhost so the file looks like the following code but the issue that facebook saying they didn't detect the og: title and description and image ... weird maybe i'm doing something wrong or the code is wrong ?
Just to note i use the facebook debug to scrape it and check : https://developers.facebook.com/tools/debug/sharing/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="ar" dir="rtl" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta property="fb:admins" content="John.Evenetcha"/>
<meta property="fb:app_id" content="2217370698541973"/>
<meta property="og:locale" content="ar_AR">
<title> تيار المحبة </title>
<meta name="description" content="القيادي بحزب تيار المحبة حسام الهمادي ينفي اشاعة التحالف مع نداء تونس ويصفها">
<meta name="Keywords" content="Tayar Al Mahaba" />
<meta property="article:author" content="https://www.facebook.com/John.Evenetcha" />
<meta property="article:publisher" content="https://www.facebook.com/John.Evenetcha" />
<meta property="og:type" content="article" />
<meta property="og:title" content="تيار المحبة"/>
<meta property="og:image" content="https://scontent.ftun2-1.fna.fbcdn.net/v/t1.0-9/44410830_2120345971363361_6384115955156385792_n.jpg?_nc_cat=111&_nc_ht=scontent.ftun2-1.fna&oh=246eea65cc7fddd40108f6bd8f840876&oe=5C52445D"/>
<meta property="og:site_name" content="تيار المحبة"/>
<meta property="og:description" content="القيادي بحزب تيار المحبة حسام الهمادي ينفي اشاعة التحالف مع نداء تونس ويصفها"/>
<meta http-equiv="REFRESH" content="0;url=https://tayar-al-mahaba.cf/TAM/news/view/9">
<BODY>
Redirecting...
</BODY>
</head>
</html>
Solved the issue! the problem was that i generate it using VB.NET and got System.Text.Encoding.Unicode in the rewrite method i though that will make it good :D

Meta Tag in HTML Mail is partly shown

We have vom .txt dokuments with our email content as HTML code.
Problem is, that we had to add some blank lines so the meta tag is not shown in the mails.
Until now, we had 5 blank lines, but with the Greek mails we need around 20 blank lines for this.
Is there a less ugly solution for this problem?
The affected meta tag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
The Code in the Document:
Subject:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0," />
<style type="text/css">
//some css
</style>
</head>
//followed by body
Example in Mail:
-equiv="Content-Type" content="text/html; charset=utf-8">
The Mail is displayed as coded after this line.
Can someone please help?
Thank you!
Your message should not display as HTML at all. We can only surmise that adding empty lines somehow exposes a bug in some webmail clients. You should not be relying on this; you should send valid messages. Here is a simple minimal example of a valid HTML email message.
From: you <your.address#example.com>
To: recipient <their.address#example.net>
Subject: whatever you like
Mime-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 8bit
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0," />
<style type="text/css">
//some css
</style>
</head>
//followed by body
I don't think the http-equiv is even necessary any longer, given that the MIME content declaration already sets things up for properly displaying it, but YMMV.
The Content-Transfer-Encoding: 8bit means lines have to be shorter than some 1,000 characters. If that's a problem, maybe employ a different content-transfer-encoding (quoted-printable, perhaps; but then you have to program that, too).

charset=utf-8 - but it cannot display "ü"

I declared the charset like all current HTML5 websites, but now German letters cannot be displayed anymore. If I leave the declaration out it works again. I think one should have that declaration. What is wrong?
HTML
<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="content-type" content="text/html,charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>äää</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
üüü ääää öööö
</body>
</html>
I believe that the charset parameter needs to be separated from the MIME type by a semicolon, not a comma. See the W3 docs.
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
you have insert , instead of ; between charset and text/html
try this:
<meta http-equiv="content-type" content="text/html; charset=utf-8">
Check that your html file is saved in UTF-8 and if you use HTML5 declaration your meta can look like:
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
.
.
.
</head>

local language characters not displayed when I use #include file

So the way I set up my website is users are redirected to the content page based on the QueryString value.
But the header stays the same.
Problem I am having is the local language characters.
They are not displayed in the content page even though meta-equiv is there when I check the source code.
What may be the problem here? How can I fix it?
Thanks a million..
<%
Section = Request.QueryString("Section")
If Section = "" then
%>
<!-- #Include File="home/index.asp" -->
<%
ElseIf Section = "home" then
%>
<!-- #Include File="home/index.asp" -->
<%
ElseIf Section = "friends" then
%>
Two things you can try
Open your page in Notepad and open the Save As box. What encoding is displayed? If ANSI is selected then change it to UTF-8
Add <%#CODEPAGE="65001"%> at the top of your asp page
Edit - I tried adding the following as a comment but I couldn't format it
You're seeing giriÅŸ instead of giriş
Look at your source code - it contains
<meta http-equiv="Content-Type" content="text/html; charset=windows-1254" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-9">
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
it should contain
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />