473,386 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

how to show greek letters

15
Hi all,
I'm having trouble trying to enter/retrieve Greek characters.
I have an astronomical dbase in MySQL. As you may know, lots of sky objects have Greek letter names (alpha Centauri, etc) but I want to enter these - and have the user see them - as the actual greek characters. Copying and pasting from character map doesn't work (if I copy the greek letter gamma, when I paste it into the field in PHPMyAdmin it comes out as "g" and likewise when the query is executed on the web page through PHP). Setting the field type to "Binary" and entering 0x65 causes the field on the web page to be blank.
I have set the collation for utf-8 in PHPMyAdmin, and the charset to utf-8 on the web page.
I need those Greek letters!
Cheers,
Starman
Sep 24 '07 #1
6 17304
Atli
5,058 Expert 4TB
Hi Starman.

If your database is set to use UTF-8 this must be a problem with your PHP script.

Are you using any functions on the string before you output them? Like the htmlentities() function, for example, will assume the string is ISO-8859-1 unless you specify the charset.

If you could show us the code, we could help you spot the problem, if it is there.
Sep 24 '07 #2
pbmods
5,821 Expert 4TB
Heya, Starman.

What's your connection encoding?

Try adding these lines just after you connect to your MySQL database:
Expand|Select|Wrap|Line Numbers
  1. mysql_query("SET NAMES 'utf8'", $dbConn);
  2. mysql_query("SET CHARACTER SET 'utf8'", $dbConn);
  3.  
where $dbConn is your MySQL connection resource.
Sep 25 '07 #3
starman
15
Heya, Starman.

What's your connection encoding?

Try adding these lines just after you connect to your MySQL database:
Expand|Select|Wrap|Line Numbers
  1. mysql_query("SET NAMES 'utf8'", $dbConn);
  2. mysql_query("SET CHARACTER SET 'utf8'", $dbConn);
  3.  
where $dbConn is your MySQL connection resource.
Hi,
Thanks for your quick reply! This is the page coding (it's just a trial page at the moment). The include file works as it's supposed to, so I don't think the problem lies there. It holds the dbConnect function. 'Close' is the name of the table (I've just had a thought - could "close" be a reserved word somewhere?)
[PHP]<?php
include('connection.inc.php');
$conn = dbConnect();
mysql_query("set names 'utf8'", $conn);
mysql_query("set character set 'utf8'", $conn);
$sql = "select * from close";
$res = mysql_query($sql) or die (mysql_error());
$numrows = mysql_num_rows($res);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Created on: 24/09/2007 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<p>A total of <?php echo $numrows; ?> records.</p>
<table width=100%>
<?php
while ($row = mysql_fetch_assoc($res))
{
?>
<tr>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['constellation']; ?></td>
</tr>
<?php } ?>
</body>
</html>[/PHP]
Sep 26 '07 #4
starman
15
Hi again,
Just to say I've solved the problem! My particular solution is actually quite complicated, since the circumstances are not simply one-for-one; sometimes, a greek letter will need to be followed by a number as well, and I need roman letters and numbers too! However, if anyone needs a simple one-to-one conversion function, I can easily adapt (i.e., vastly simplify) my existing oneinto a "switch" process using PHP. If you're interested, drop me a line at:
[removed]
Sep 27 '07 #5
pbmods
5,821 Expert 4TB
Heya, Starman.

For your protection, I have removed your email address from your post.

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Sep 28 '07 #6
starman
15
Just to say "Thanks" everyone who helped! Much appreciated.
Sep 28 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Vangelis Natsios | last post by:
I'm trying to provide a case-insensitive search in greek texts from a jsp page. The check goes like this: if (el_title.toUpperCase().indexOf(selected_title.toUpperCase()) { .... } where...
9
by: PAN | last post by:
I need some guidance here I've written this HTML code using the Windows Notebook: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EL"> <html> <head> <title>This is a Greek language title ->...
5
by: michael.s.gilbert | last post by:
hello all, this message is geared toward those of you in the scientific community. i'm looking for a python plotting library that can support rendering greek symbols and other various characters...
1
by: interuser | last post by:
Hi I have a web app that has a webpage on which there is a textbox and a submit button. if I type greek and press submit, the greek does not go through to the webserver. If I type greek and...
2
by: Dave | last post by:
Can someone tell me how to add Greek letters to a string? In this case I need to add the Greek letter mu to a string for display on the screen and don't know how to do it. Thanks in advance for...
0
by: nass | last post by:
hello everyone and happy new year. i am not sure how to tackle this problem or where is originates from so i am writing here in hope that if you can not help you can at least point me in a...
8
by: =?gb2312?B?yMvR1MLkyNXKx8zs0cSjrM37vKvM7NHEsru8+7z | last post by:
I lookup the utf-8 form of delta from the link. http://www.fileformat.info/info/unicode/char/0394/index.htm and then I want to print it in the python ( I work under windows) #!/usr/bin/python...
12
by: Punkis | last post by:
Hi all, I have a problem with my php and mysql project. I use an auctions software, named phpauction for my project. I import into my database with utf8 encodingm and I can see the greek...
2
by: Benx | last post by:
Hello, I have to display a mixed letters greek and latin like: "alpha" ursa major, "beta" centauri, "delta" velorum, "epsilon"....., need help to do it. Thank's
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.