special character encoding error utf-8 iso-8859-1 - jsf

I'm having problems displaying special characters (like é and à) in my jsf application. These characters get displayed as a question mark or é.
Therefore I tried a simple thing. I have a page with a form post to a result page displaying the posted parameters.
page 1
<head>
<meta http-equiv="Content-Type" content="text/html; UTF-8">
</head>
<body>
<form method="POST" action="http://localhost:8080/test/result.xhtml" name="data" target="_blank">
<input type="hidden" value="Pierre;DUPONT;5300;Seilles;;Rue des écoles 18;fr;;" name="customer"/>
page result
<head>
<meta http-equiv="Content-Type" content="text/html; UTF-8"/>
</head>
<body >
test
<h:inputText value="${param.customer}"/>
</body></html>
The result is shown as ue des écoles in stead of ue des écoles
I'm developing in Eclipse with Text-file encoding on UTF-8 and running on tomcat 6.024
What am I doing wrong?

Related

How to properly write codes and styles on this?

I am having difficulty on how to properly display this like the real ones. Right, so
here's my piece of code. You can try this on your respective IDE's to view the page
because basically I cannot drag and drop here the image. I'm using html CSS, vs code. its just basically the interface of google with header, main, serach bar at the middle and those buttons and navs at the bottom of it.
I'm having difficulty on trying to make this like a real google ui. :(( Just a beginner.
<!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.0">
<title>Google Login</title>
<link rel="shortcut icon" href="google-logo-png-29534-32x32.ico" type="image/x-
icon">
</head>
<body>
<div id="header">
Gmail
Images
<img src="pad.png">
<img src="cs-logo.png">
</header>
<main>
<input type="search">
<img src="google-voice-search-icon.png">
<img src="googlelogo_color_272x92dp.png">
<button>Google Search</button>
<button>I'm feeling lucky</button>
</main>
<p>Google offered in: Filipino <a href="#">Cebuano</p>
</div>
</body>
</html>
The property src="" in the img tag will take the image from the local path or an URL to an image.
If you want, for example, the doodle's image you have two options:
Download the image from the Google web and then overwrite the img tag with something like this: <img src="/path/to/the/image.png"
Get the URL to the image in web(in this case: https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png) and then overwrite the img tag with something like this: <img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"
I hope this could help.

Nodejs and mongodb: File Management

I'm a beginner at Nodejs.
What I want to do is, upload a file (not an image file), like a .txt, .c, .py, and store it in the mongodb database. I also want to be able to retrieve the file and access the file contents, like what is written inside those files.
I hope the made some sense.
Here is the html script I used to upload a file.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,
initial=scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>FILE UPLOAD DEMO</title>
</head>
<body>
<h1>Single File Upload</h1>
<form action="/upload"
enctype="multipart/form-data" method="POST">
<span>Upload File</span>
<input type="file" name="myfile" required/> <br>
<input type="submit" value="submit">
</form>
</body>
</html>
I'd really appreciate if you helped me out on this.
You should check out GridFS. There's a whole ton of GridFS tutorials out there (example) but it's also worth noting that if you're certain that your files will be smaller than 16 megabytes, you can also just store the files as a part of BSON documents, which allow you to store binary data (ref).

Using #local_variable in CSHTML code in asp-page

I develop ASP.Net Core 2.1 RazorPages web application. I want parametrize the the value of asp-page tag helper.
So I use following code in cshtml file. There is a del_link local variable defined in begining of file. This variable is late used as parameter for second asp-page tag helper.
#page
#{
string del_link = "/UnloadDelete";
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div>
<a asp-page="/UnloadEdit">Details</a>
<a asp-page=#del_link>Delete</a>
</div>
</body>
</html>
ASP.Net Razor generate following HTML code.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div>
Details
Delete
</div>
</body>
</html>
As you can see in HTML code, asp-page="/UnloadEdit" is properly rendered to HTML code, but asp-page=#del not, it is rendered to <a href="">. How I can use local variable for asp-page tag helper in Razor Pages?
Thanks in advance.
You must pass a page name to the asp-page attribute. So what you are trying to do is not supported. If #del_link renders a relative URL, you can pass that to the href attribute instead. There may be other suitable solutions, depending on why you feel the need to use #del_link at all.

Cannot view PNG image of docusign document

I trying to use the Docusign REST api to retrieve a page image from a specified envelope.
Using the GetDocumentPageImage api call specified in the docusign's developer resources:
https://docs.docusign.com/esign/restapi/Envelopes/Envelopes/getDocumentPageImage/
When I make a call, I receive in the response header:
content-type:image/png
When I save the raw binary to disk and try to open it, it doesn't seem to be a PNG file. Opening the file a text editor to inspect the contents shows that th file begins with:
˝PNG IHDR...
which seems to be a valid PNG file header, but ends with:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Image</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<meta name="robots" content="noindex, noarchive" />
</HEAD>
<body MS_POSITIONING="GridLayout">
<form method="post" action="./image.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTUxMTcwNzgxMGRkQRcFn//jRJ+06xbvFxUi4rKEZIQb6fRuQKDtT8P6CNnm/JfLfRFk+peLPbzp4xXAtupqCca4iRWWnIYdQRieIA==" />
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="40952B3F" />
</form>
</body>
</HTML>
I tried to strip the end part of the file that has the Microsoft rubbish with no luck. It seems the response content has been encoded differently some way and the docs don't explain what this is and how to decode.

how to send an alert message with Turkish characters

I am programming a Web-Application with Java EE and JSF.
I want to give alert (javascript) messages with Turkish characters (such as Ç,ü and ö etc.) on my app. But, after alert function is fired, I see the alert message with unrelated characters such as <?>, instead of Turkish characters on .xhtml pages on any browser (I tried it on IE10 and Chrome).
I need an advice to handle the problem. If I find a solution, I can also use this to set values of element (ex./h:commandButton) by javascript.
EDIT:
Additional information - Static strings that includes Turkish letters on html or jsf tags are shown properly. However, when I change them via some javascript functions, if there is any Turkish characters in strings that are changed, these Turkish letters cannot be shown properly.
It is too old question but I want to answer for maybe someone need.
If your problem with alert messages, open your javascript file on notepad and save as with Utf-8 options.
Or you can use same technic for others js file you need encoding char.
If its just specific to chrome may be you could try changing the page encoding.
Got Control->Tools->Encoding and change that to Auto Detect or Unicode or turkish etc..
If its a general issue then add the meta info
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1254">
<META HTTP-EQUIV="Content-language" CONTENT="tr">
or
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-9">
<META HTTP-EQUIV="Content-language" CONTENT="tr">
Example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1254">
<META HTTP-EQUIV="Content-language" CONTENT="tr">
<title>Sample</title>
<script>
function alertText() {
alert(document.getElementById("turkish").innerHTML);
}
</script>
</head>
<body>
<div id="turkish">Türkçe olarak hellow dünya</div>
<input type="Button" onclick="alertText()" value="Say" />
</body>
</html>

Resources