473,399 Members | 3,401 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,399 software developers and data experts.

Charset

Hi, I'm a newbee, also in english.
The thing is that I have a kind of javascript based search engine that
use a .txt as its database, it has several field delimited by tabs.
What I want to do is using the same application to diferents projects. I
just change the look, the datas and I have another beautiful serach
engine.
How I don't know much about javascript, I made a PHP script that builds
a .txt with identical structure to the one I have just explained and
fill it with the datas. But It doesn't work.
I have noticed that the javascript says anywhere something about
"unicode" charset. The PHP script make a entirely new file each time
from a Access database, I do this because I needed to modify some
database content in some fields, and I think that It doesn't use the
same charset that javascript. I belive this because I tested to paste
same records directly from txt formed by PHP script to original txt and
when saving WordPad tell me something about that I'm saving without
format and I am going to loose any format issue. And after this, I could
see throught the serach engine the records pasted in the txt.

I am using WinXP, Nusphere, Dreamweaver, etc, everything in spanish (so
the charset, I think It is ISO LATIN number-015, with Euro, I'm just
guessing)

Thank's a lot for any help.

Borja González
oa*********@yahoo.es

Remove 123 manually.
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Jul 17 '05 #1
3 8523
Borja Gonzalez <bo***@nccextremadura.org> wrote:
How I don't know much about javascript, I made a PHP script that builds
a .txt with identical structure to the one I have just explained and
fill it with the datas. But It doesn't work.
What doens't work? You can't create the file or you can't reproduce the
required structure of it?

[charsets] I am using WinXP, Nusphere, Dreamweaver, etc, everything in spanish (so
the charset, I think It is ISO LATIN number-015, with Euro, I'm just
guessing)


Take a look at the thread '"smart" quotes in PHP'
(Message-ID: <Xn***************************@24.24.2.166>) which might
give you some hindts on how to convert oce you figure out whtat the
actual encoding is.

--

Daniel Tryba

Jul 17 '05 #2
Hi,
What doens't work? You can't create the file or you can't reproduce the
required structure of it? What it doesn't work is the javascript search engine. I mean, I manage
to build the file
and it looks like the one that i need, but the javascript doesn't read
it.
[charsets]
I am using WinXP, Nusphere, Dreamweaver, etc, everything in spanish (so
the charset, I think It is ISO LATIN number-015, with Euro, I'm just
guessing)


Take a look at the thread '"smart" quotes in PHP'
(Message-ID: <Xn***************************@24.24.2.166>) which might
give you some hindts on how to convert oce you figure out whtat the
actual encoding is.


I have read it but and... correct me I am wrong:
The original database was encoded using unicode, this I have read from
the javasript code:

<object id="db" CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83"
VIEWASTEXT>
<param NAME="DataURL" VALUE="datdb.dll">
<param NAME="UseHeader" VALUE="True">
<param NAME="CharSet" VALUE="unicode">
<param NAME="FieldDelim" VALUE=" ">
</object>

The new database I have built It in not unicode but other encoding
system, so I anyhow have
to convert it:

$fp=fopen("datdb.txt","w");

$cabecera="\"Titulo\"\t\"Descripcion\"\t\"Localida d\"\t\"Seccion\"\t\"Enlaces\"\t\"Correo\"\r\n";
fputs($fp, $cabecera);
$link=mysql_connect("localhost");
mysql_select_db("test",$link);
$query="SELECT Titulo,Autores,Tema,Archivo FROM abstracts";
$resultado=mysql_query($query,$link);
while ($regdb=mysql_fetch_array($resultado, MYSQL_ASSOC)) {
$regtxt="\"<a href=\"\"abstracts/";
$regtxt.=$regdb["Archivo"];
$regtxt.="\"\" class=\"\"rsURL\"\">";
$regtxt.=ereg_replace("\r\n","
",ucfirst(strtolower($regdb["Titulo"])));
$regtxt.="</a>\"";
$regtxt.="\t\"";
$regtxt.=ereg_replace("\r\n"," ",$regdb["Autores"]);
$regtxt.="\"\t\"";
$regtxt.="Badajoz";
$regtxt.="\"\t\"";
$regtxt.="Sesiones, " . $regdb["Tema"];
//$regtxt.="\"\t\"<span></span>\"\t\"<span></span>\"";
$regtxt.="\"\r\n";
fputs($fp, $regtxt);
fclose($fp);
And my question is:
How do I manage that php script write the file encoded in unicode?

Thanks a lot
Borja
--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
Jul 17 '05 #3
Borja Gonzalez <bo***@nccextremadura.org> wrote:
Take a look at the thread '"smart" quotes in PHP'
(Message-ID: <Xn***************************@24.24.2.166>) which might
give you some hindts on how to convert oce you figure out whtat the
actual encoding is.
I have read it but and... correct me I am wrong:

[snip] The new database I have built It in not unicode but other encoding
system, so I anyhow have
You know which?

[some string] fputs($fp, $regtxt);
fclose($fp);
And my question is:
How do I manage that php script write the file encoded in unicode?


As already mentioned in the thread mentioned above:
1-utf8_encode
2-iconv
3-str_replace

1 is preferable but your data needs to be in iso-8859-1 (if you are
using iso-8859-15 you could translate the generic curreny char to the
EUR manually)

2 is optionally, so your server might lack iconv support

3 if all else fails your last hope.

--

Daniel Tryba

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: CJ Oxx | last post by:
I have a problem with browser charset recognition when using PHP 4.1.2 (this is the PHP version which our hosting company provides). For charset recognition, I use the following meta-tag: <meta...
12
by: lawrence | last post by:
How do I get PHP to tell the server that when I echo text to the screen, I need for the text to be sent as UTF-8? How does Apache know the right encoding when all the text is being generated by...
4
by: Ka | last post by:
I install a mysql server in default installation with latin charset, but I want to use GBK(a chinese charset), so that I can store and search chinese words directly. so, I download, unpack and...
8
by: Ben Sharvy | last post by:
I don't reallly understand charsets, but I see that you are supposed to declare one. I am putting a paper up in HTML. It uses some special characters, like umlauts and diacriticals. The biggest...
25
by: Andrew Thompson | last post by:
I was recently loading an HTML editor so I could find the charcode of that particularly obscure character using the editor's 'insert special character' dialog. It occured to me there had to be...
35
by: The Bicycling Guitarist | last post by:
My web site has not been spidered by Googlebot since April 2003. The site in question is at www.TheBicyclingGuitarist.net/ I received much help from this NG and the stylesheets NG when updating the...
28
by: Xiaotian Sun | last post by:
I added the following line to the header of my html file <meta http-equiv="content-type" content="text/html; charset=utf-8"> hoping browsers will use UTF-8 encoding. But all browsers I tried...
0
by: Chris | last post by:
Hi, I am relatively new to using CDO.Message, and I desperately need some help! I have an ASP 3.0 application that uses CDO to send automatic alerts through Exchange 2003. How do I determine...
7
by: gmclee | last post by:
Hi there, I am writing a program to load HTML from file and send it to IE directly. I've met some problem in charset setting. Most of HTML have charset "us-ascii", for some reason, some UNICODE...
0
by: mubx2000 | last post by:
I Did Some Application (In Symbian C++) To Get Email Message from POP3 Server Using Sockets Engine, The Message Containes (Arabic) Language Text ,Inside the message body It's Charset should be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.