MySQL php and CHARACTER SET error
Still very new to php and MySQL, in fact this is my first
site using it.
I have got an issue with displaying characters, namely the
£ sing, all I get is an ? displayed.
I have been told to use, utf8 in the database field but this
has not helped cure the problem.
I'm building the site in DW CS3 and it's all running off my
Mac using OS X 10.5.1 and the built in php client.
Could anyone show me the right way to go?
Ok I think my IQ is falling me, it's been a long week.
<?php header('Content-type: text/html;charset=utf-8');
?>
Is the first line of code on the test page I have got
running. I have no error but I also have no £ sings.
Here is the live page:
http://www.epos-acoustics.com/test.php
The page code:
<?php header('Content-type: text/html;charset=utf-8');
?>
<?php require_once('Connections/epos.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType,
$theDefinedValue = "", $theNotDefinedValue = "")
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue)
: $theValue;
$theValue = function_exists("mysql_real_escape_string") ?
mysql_real_escape_string($theValue) :
mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" :
"NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) .
"'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" :
"NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue :
$theNotDefinedValue;
break;
return $theValue;
mysql_select_db($database_epos, $epos);
$query_rs01 = "SELECT * FROM epos_shop ORDER BY my_shop_id
ASC";
$rs01 = mysql_query($query_rs01, $epos) or
die(mysql_error());
$row_rs01 = mysql_fetch_assoc($rs01);
$totalRows_rs01 = mysql_num_rows($rs01);
?>
<!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=UTF-8" />
<title>shop text test</title>
</head>
<body>
<?php do { ?>
<table width="600" border="0" cellspacing="2"
cellpadding="2">
<tr>
<td width="92">Product name: </td>
<td width="494" colspan="2"><?php echo
$row_rs01['my_shop_product']; ?></td>
</tr>
<tr>
<td valign="top">Description:</td>
<td colspan="2"><?php echo
$row_rs01['my_shop_text']; ?></td>
</tr>
<tr>
<td>Price:</td>
<td colspan="2"><?php echo
$row_rs01['my_shop_price']; ?></td>
</tr>
<tr>
<td height="30" colspan="3"> </td>
</tr>
</table>
<?php } while ($row_rs01 = mysql_fetch_assoc($rs01));
?></body>
</html>
<?php
mysql_free_result($rs01);
?>
Am I missing the point or do I have something wrong with the
table or field?
Similar Messages
-
Database Encoding and character set
Hi,
Is it possible to change [some easier straigtht forward way] the encodings and character set for a database [DB11 in this case]?
I have a database which has UTF16 and MSWIN1252 as the encoding and characterset, i want to change it to UTF8 for some testing and reasons.
Thanks,
AnupamYou should detail what you mean by encoding and character set.
A database has 2 character sets:
- the character set for CHAR, VARCHAR2 and CLOB
- the national character set for NCHAR, NVARCHAR2 and NCLOB.
You have 2 ways to change the database character set:
- with ALTER DATABASE statement
- with export/import
See http://download-uk.oracle.com/docs/cd/B10501_01/server.920/a96529/ch10.htm#1656 -
How to know the existing NLS_LANG and Character Set
Dear all
How can I know about the existing NLS_LANG and Character set setting for Oracle 8 (Unix platform)
Thank you
KwanYou can see this from the following
NLS_DATABASE_PARAMETERS (i think it is how database was created)
NLS_INSTANCE_PARAMETERS (this instance)
NLS_SESSION_PARAMETERS (this you can set just for your login session).
HTH
Srinivasa Medam -
Java Character set error while loding data using iSetup
Hi,
I am getting the following error while migrating settup data from R12 (12.1.2) Instance to another R12 (12.1.2) Instance, Both the Database has same DB character set (AL32UTF8)
we are getting this error while migrating any setup data
Actual error is
Downloading the extract from central instance
Successfully copied the Extract
Time taken to download Extract and write as zip file = 0 seconds
Validating Primary Extract...
Source Java Charset: AL32UTF8
Target Java Charset: UTF-8
Target Java Charset does not match with Source Java Charset
java.lang.Exception: Target Java Charset does not match with Source Java Charset
at oracle.apps.az.r12.common.cpserver.PreValidator.validate(PreValidator.java:191)
at oracle.apps.az.r12.loader.cpserver.APILoader.callAPIs(APILoader.java:119)
at oracle.apps.az.r12.loader.cpserver.LoaderContextImpl.load(LoaderContextImpl.java:66)
at oracle.apps.az.r12.loader.cpserver.LoaderCp.runProgram(LoaderCp.java:65)
at oracle.apps.fnd.cp.request.Run.main(Run.java:157)
Error while loading apis
java.lang.NullPointerException
at oracle.apps.az.r12.loader.cpserver.APILoader.callAPIs(APILoader.java:158)
at oracle.apps.az.r12.loader.cpserver.LoaderContextImpl.load(LoaderContextImpl.java:66)
at oracle.apps.az.r12.loader.cpserver.LoaderCp.runProgram(LoaderCp.java:65)
at oracle.apps.fnd.cp.request.Run.main(Run.java:157)
Please help in identifying and resolving the issue
SachinThe Source and Target DB character set is same
Output from the query
------------- Source --------------
SQL> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
VALUE
AL32UTF8
And target Instance
-------------- Target----------------------
SQL> select value from nls_database_parameters where parameter='NLS_CHARACTERSET';
VALUE
AL32UTF8
The Error is about Source and Target JAVA Character set
I will check the Prevalidator xml from How to use iSetup and update the note
Thanks
Sachin -
Character Set Error in PL/SQL
Hi,
While connecting to PL/SQL Developer I am getting this following error.
Database character set (AL32UTF8) and client character set (WE8MSWIN1252) are different.
Character set conversion may cause unexpected results.
Note: you can set the client character set through the NLS_LANG registry key in
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_XE.
Please help me avoid this error.
Thanks.That is presumably a PL/SQL Developer error. You may want to contact the vendor of that particular product to understand that warning because it makes no sense to me.
It is perfectly appropriate, and quite normal, for the client character set to be a subset of the database character set. Setting the client character set to match the database character set can create a host of problems that lead to invalid data being stored in the database. This appears designed to increase the odds that this particular tool will work correctly while decreasing the odds that everything else in your environment will work correctly. That seems like a relatively poor trade-off to me.
Justin -
Character set error during startup
Hi all
This is a follow up of the following problem: Paralel Install of Ora8i and Ora9i
Please read it before continue.
This seems to be a database problem, so that I post it here:
I'm going forward with my problem. It seems that's a problem with versions in the startup routine. When I try to start the instances with the 9i dbstart tool, all is going well.
Now I changed the oracle script in /etc/init.d in a was that it will explicitly start the 9i dbstart tool. Now the instances come up normally, except the following error during mount of the instance:
ORA-12709: error while loading create database character set.
For me it looks like an mistaken during the creation of the database. Or perhaps its again a version problem.
Any clue around for this?
Greetings
SalvatoreOk Here the answers:
1) Error during startup
2) Error during startup
3) Error during startup
The Oracle Environment seems to be OK. I can use all variables in the oracle script during OS boot.
I suspect that something is going wrong during the database creation. But in the Oracle Error Message Documentation I read "contact Support Services". So I'm unsure what to do. AFAIK we don't have a support contract, nor I can use any paid service. -
Character set error oracle 10g
I have a 10g TARGET database with a single byte character set of western european and 9i SOURCE databse with multibyte character of UTF8 since the character sets are different to load data from 9i to 10g I am using national character set NCHAR columns on target database to store the multi byte data :
this is the table i am working on loading
CREATE TABLE RAN_TEST1_MDL
( MODEL_ID NUMBER(15) NOT NULL,
PRODUCT_ID NUMBER(15) NULL,
MODEL_CODE NVARCHAR2(540) NULL,
ODM_CODE NVARCHAR2(900) NULL,
MODEL_DESC NVARCHAR2(1200) NULL )
tablespace csn_d_01 LOGGING NOCOMPRESS NOCACHE NOPARALLEL MONITORING
The table is test table on oracle 10g database .
This is the query I am running
INSERT /*+append*/ INTO WORK_HIER_MDL(
MODEL_ID,
PRODUCT_ID,
MODEL_CODE,
ODM_CODE,
MODEL_DESC
SELECT
MODEL_ID,
PRODUCT_ID,
MODEL_CODE,
ODM_CODE,
MODEL_DESC
FROM SHLD_HIER_MDL
shld_hier_mdl is source table from oracle 9i multi byte UTF8 database.
WORK_HIER_MDL is target table on oracle 10g single byte western european databse
Error : ORA-29275: partial multibyte character
When I describe the source table SHLD_HIER_MDL ( on 9i oracle accesed thru a db link ) I get the following error
ORA-01460: unimplemented or unreasonable conversion requested
I think ORA-29275 and ORA-01460 are correleted . Can anyone suggest what could be the cause for this ? ThanksError: ORA-29275 (ORA-29275)
Text: partial multibyte character
Cause: The requested read operation could not complete because a partial
multibyte character was found at the end of the input.
Action: Ensure that the complete multibyte character is sent from the
remote server and retry the operation. Or read the partial
multibyte character as RAW.
you can export the table and import on 10g.Rename the table,create your test table and use IAS. -
Hi Everyone.
We are evaluating switching for MySQL4.0.x (native support
via CF) to MySQL5.0.x (support via JDBC ConnectorJ) and we are
having some character set issues with on our evaluation server.
When we had it configured with MySQL4.0.x using the built in MySQL
driver we always used the connection string to use the UTF-8
character set:
useUnicode=true&characterEncoding=utf-8
We have tried using this with the JDBC driver but it doesn't
appear to have any effect, all the special character are coming out
as mangle multiple character string, which is the same as we see if
we connect to the server from the command prompt using the default
"Latin1" character set. If we connect from the command prompt using
UTF-8 everything looks ok, so I'm guessing the connection string
has changed syntax. I've checked the ConnectorJ documentation and
it appears the connection string should now be:
characterEncoding=UTF-8
However, this did seem to make any difference.
Any ideas?andrewdixon wrote:
> Hi Everyone.
>
> We are evaluating switching for MySQL4.0.x (native
support via CF) to
> MySQL5.0.x (support via JDBC ConnectorJ) and we are
having some character set
> issues with on our evaluation server. When we had it
configured with MySQL4.0.x
> using the built in MySQL driver we always used the
connection string to use the
> UTF-8 character set:
>
> useUnicode=true&characterEncoding=utf-8
>
> We have tried using this with the JDBC driver but it
doesn't appear to have
> any effect, all the special character are coming out as
mangle multiple
> character string, which is the same as we see if we
connect to the server from
> the command prompt using the default "Latin1" character
set. If we connect from
> the command prompt using UTF-8 everything looks ok, so
I'm guessing the
> connection string has changed syntax. I've checked the
ConnectorJ documentation
> and it appears the connection string should now be:
>
> characterEncoding=UTF8
>
> However, this did seem to make any difference.
>
> Any ideas?
>
> Kind regards,
>
> Andrew.
>
try:
1) add the following to the end of JDBC URL in CF Admin DSN
config
screen for your db:
?useUnicode=true&characterEncoding=utf8&characterSetResults=UTF-8
(note: NOT in the "connection string" box, but at the end of
jdbc url!)
2) in your Application.cfm file add the following lines right
after
<cfapplication> tag:
<cfscript>
SetEncoding("form","utf-8");
SetEncoding("url","utf-8");
</cfscript>
<cfcontent type="text/html; charset=utf-8">
3) on every cfm page in your application add the line:
<cfprocessingdirective pageencoding="utf-8">
as the first line of code
all three or combination of 2 of the above usually solve the
problems
with displaying utf-8/unicode encoded text from db. which
combination
works depends on your db setup...
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
http://www.sabai-dee.com -
Non supported character set error
Hello, I have a j2ee application that uses OLAP API to make queries against cubes created with cwm2 packages, in a database (db 1).
I've replicated the schema in another db (db 2), importing the user (with a dmp file) and throwing the object creation scripts. This works right, and the objects in the catalog are all validated. But my j2ee application doesn't work against this new user; some errors appears.
The two databases are the same version, the only difference is that db 2 was installed using WE8ISO8859P15 character set. Is there any problem with this set and the olap api ? The character set in db 1 is WE8ISO8859P1.
The error is:
"oracle.express.idl.util.OlapiException: Non supported character set: oracle-character-set-46".
I'm using ojdbc14.zip and orai18n.zip in the WEB-INF/lib directory of my application. My database version is 10g r. 2 (10.2.0.1.0)
Thanks by your reply.At what point does this error occur? Can you provide more of the stack trace?
Geof -
Hello everyone. I just installed Oracle8i on my Slackware7 linux box and I can not seem to start the dbassist tool that comes with it. When I attempt to start the assistant it throws an JNLS exception, that reads as shown bellow.
"JNLS Exception:oracle.ntpg.jnls.JNLSException Unable to find any National Character Sets. Please check your Oracle installation."
Now my question is (obviously) how do I go about fixing this annoyance? Could one of my Enviorment vars. be causeing this to occur? Or am I barking up the wrong tree?
Any help would be greatly appreciated...
thanx in advance james...The JNLS error is a bug...What u have to do is just ignore the error and go ahead with the database creation...
I think this should help u out...
Edwin
email:[email protected] -
"Could not determine request character set " error while recording
I am using the OATS 9.3 GA version. When I try to record a load testing script using Openscript, I am getting the following error and the recording gets stuck without moving to the next page.
!ENTRY oracle.oats.scripting.modules.http.proxyRecorder.ProxyRecorderQueueRunnable 2 0 2011-08-11 14:50:26.328
!MESSAGE Could not determine request character set for https://adcgek13.us.oracle.com:10616/sales/BIProxy?cid=BIPresentationServer&RedirectURL=res%2fsk_blafp%2fdvt%2fBIChart.swf, referer=https://adcgek13.us.oracle.com:10616/sales/faces/mooOpportunityHome?_afrLoop=83903503964000&webApp=HomePage&fndHomePageViewId=%2FAtkHomePage
Should I check any of the script or record settings to fix this?Hello
Where did you get the 9.30 GA version? is not yet available for download.
Regards
Alex -
PHP and result sets: size and time
Hi
I'm tasked with debugging and "fixing" a PHP application which (someone else developed) is running slowly and "timing out", now that data is in there. I set about inserting some brief timing "debug" stuff within the code to attempt to determine where the rate limiting steps were happening. I found two areas in the code which were quite slow:
1) Query of the oracle database via a package, declaration of the procedure is:
procedure findAllSorted(sortMode in string, resultSet IN OUT types.cursortype);
2) looping on this and filling the array into objects
while ($res = $result->FetchRow()) {
// don't use $array[] = $this->load($res);, it throws an error
$array[] = $this->doLoad($res);
My method timed the execution of both these steps:
1) Execution for oracle is:11.60035777092 Seconds
2) Execution for loop is:17.87319111824 Seconds
the amount of data that is returned by the fiindAllSorted() procedure is not what I'd call high, although that is part of my question here ... how much is a lot?
When I execute the procedure in PL/SQL Developer (and get all rows, not just the first 10) there are 1600 rows returned. When saved as a CSV file its about 260K of data ... I would not have thought this was problematic.
the other part of my question is (assuming people don't say "holy cow you're returning one thousand six hundred rows") how can I speed this part of the step up?What values of oci8.default_prefetch or oci_set_prefetch() have you tried? See the discussion on p149 of The Underground PHP and Oracle Manual. I wonder if you are still using OCI8 1.2 with the lower default value.
Pre-fetching from REF CURSORS was first supported with Oracle 11gR2. You only need 11gR2 client libraries - pre-fetching from basic REF CURSORS will work when connected to older DB versions. See my blog post about Oracle Database 11gR2 Enhancements for PHP. New client libraries are available free from OTN. If you can't upgrade your Oracle Client libraries then perhaps you can refactor findAllSorted() and use pipelining. This is discussed on p172 of The Underground PHP and Oracle Manual.
Make sure your queries only select the columns you need.
Rasmus Lerdorf's recent talk http://talks.php.net/show/digg has some good overall PHP analysis and tuning tips.
To finish up, here is output from repeating a query with different prefetch values:
Time to fetch 1600 rows. Prefetch is 500 : Fetch time is: 0.085 seconds
Time to fetch 1600 rows. Prefetch is 100 : Fetch time is: 0.090 seconds
Time to fetch 1600 rows. Prefetch is 10 : Fetch time is: 0.144 seconds
Time to fetch 1600 rows. Prefetch is 0 : Fetch time is: 0.508 seconds -
Hello all,
I installed Oracle XE on RHEL 4 Linux and I found out that database character set is AL32UTF8. Does anyone know why oracle choose this character set? Maybe because of NLS_LANG env variable? Is it possible to change it to EE8ISO8859P2? Since database is still empty I can drop it and crate new database.
Do you think it is possible to set some env variables and do new oracle xe instalation including database with iso charset?
I want to have EE8ISO8859P2 charset because of doing exp/imp from another oracle iso db to oracle xe and it is much easier to do this without charset conversion.
Any help will be appreciated.
regards,
MihaWhen you download XE, you have a choice - take the 'western european' character set download, or the 'unicode' download.
No other choices.
Join us over in the XE forum where people have discussed this and found workarounds. Info about finding that forum at Re: Oracle XE Installation failed -
Database Links and Character Sets
Can I link a ARABIC Character set database to an English Character one using database links. The Application running on the Arabic database needs to read and write into the English one using a database link.
Shouldn't be a problem, assuming that all the English characters you want to represent can be properly encoded in the source system's character set. Shouldn't be a problem unless you start dealing with things like Microsoft's curly quotes.
Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC -
Utl_file and character sets
hello,
we are using AL32UTF8 character set in our database, I have a PL/SQL routine reading a csv file with utl_file into the database, Client using UTF-8 (Toad). When I have a UTF-8 csv file, everything works fine. But I want to be able to read ANSI aswell. Is there a way to read ANSI files aswell with utl_file ?
ps: I used CONVERT(v_line, 'UTF8', 'WE8MSWIN1252') and it worked. Is there a way I can read out the character set of the csv file with PL/SQL, so I dont need to use a parameter ?
Ilja
Edited by: Ikrischer on Sep 25, 2009 2:32 PMToo bad your Oracle installation doesn't have a version number or use any DDL so we would know what you are doing.
Are you using GET_LINE or GET_LINE_NCHAR or something else.
Maybe you are looking for
-
I'm sorry if I'm not using the correct terminology. When I open a new window or a link I want it to open a whole new window so I have 500 open FireFox tabs in my taskbar if I open that many windows. I do not like having everything open in one window.
-
Make full TV view while connecting to Apple TV
How to make full TV view, while connecting my iPad Air to the Apple TV???
-
when i'm trying to attach a pdf to mail from the acrobat reader i get the message above. i'm using acrobat reader 9.3.4 and outlook 2007. this is a terminal server
-
File Sharing Checkbox / FTP
We are in process of setting up a new Mac Server where we want to use as an FTP server. All HELP and tutorials indicate that the first thing you do is go to Preferences > Sharing > and check the "File Sharing" selection where you can then indicate to
-
XL Reporter Problem: Version Mismatch between server and client
When I start SAP Business One, I get the following message: "The new version of Add-on is installed. Upgrade the Add-on in the current Common DB." The version of the XL Reporter add on shown in the Add-On Administration is 881316, but the version of