473,804 Members | 2,119 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

accented characters

I cannot get accented charecters in my HTML output...
I have tried to leave the accented characters in and to use iso-8859-1,
but there it doesn't work either.
I have tried to use à entity, but & is a reserved character.
I have tried to use à or ß but the entity is not
recognised, and I get as an output in the browser "à" or "&#223"...
Maybe there is sometheing missing in the header...

This is a sample of my xml text
(the documents is a .php, for the purpuse of getting a variable from a
post...)
----------------
<?
header("Content-type: text/xml");
print '<?xml version="1.0" encoding="UTF-8"?>';
print '<?xml-stylesheet type="text/xsl" href="inf-dev.xslt"?>';
?>

<inferno>
<filtro><?=$_PO ST[filter]?></filtro>
<canto>
<n>1</n>
<passo>
<vv>1</vv>
<dante>
<v>Nel mezzo del cammin di nostra vita</v>
</dante>
<carson>
<v>Halfway through the story of my life</v>
</carson>
<nota>
<n>Carson introduces story</n>
</nota>
</passo>
<passo>
<vv>14</vv>
<dante>
<v>là dove terminava quella valle é</v>
</dante>
<carson>
<v>hill; here, the valley formed a cul-de-sac</v>
</carson>
<nota>Carson introduces cul-de-sac, often associated to the
alleys of Belfast; local
colour</nota>
</passo>
</canto>
</inferno>
-----------------------
This is the XSL:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:output method="html"/>
<xsl:template match="/">

<html>
<xsl:variable name="filter">< xsl:value-of
select="inferno/filtro"/></xsl:variable>
<head>

<title>Infern o: comparazione</title>
<link rel="stylesheet " title="main" href="stile-inf.css"
type="text/css" />

</head>
<body>
<div id="container" >

<h1>Inferno</h1>

<h3>Filtro: <xsl:value-of select="inferno/filtro"/></h3>

<xsl:for-each select="inferno/canto">
<div class="cant">
<h2>
Canto <xsl:value-of select="n"/>
</h2>
<xsl:for-each select="passo">

<xsl:if test="contains( nota,$filter)">
<div class="pass">
<table border="0" width="100%">
<tr>
<td colspan="2">
<div class="vv">
<xsl:value-of select="../n"/>,
<xsl:value-of select="vv"/>
</div>
</td>
</tr>
<tr>
<td width = "50%">
<div class="dant">
<xsl:for-each select="dante/v">
<xsl:value-of select="."/>
<br/>
</xsl:for-each>
</div>
</td>
<td>
<div class="cars">
<xsl:for-each select="carson/v">
<xsl:value-of select="."/>
<br/>
</xsl:for-each>
</div>
</td>
</tr>
<tr>
<td colspan="2">
<div class="note">
<xsl:for-each select="nota">
- <xsl:value-of select="."/>
<br/>
</xsl:for-each>
</div>
</td>
</tr>
</table>
</div>

<br/>

</xsl:if> <!--CHIUSURA TEST-->
</xsl:for-each>

</div>
</xsl:for-each>

</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

any suggestion?
Thanks,
Davide
Jul 20 '05 #1
4 1784
I have tried to leave the accented characters in and to use iso-8859-1,
If you are typing the characters in iso-8859-1 then you can just type
them directly from your keyboard and then use
<?xml version="1.0" encoding="iso-8859-1"?>'
In theory an xml parser is not forced to accept iso-8859-1" encoding but
in practice it will.

You are using
<?xml version="1.0" encoding="UTF-8"?>
which any XML parser will accept but in that case you would want to type
your characters using utf8 encoding. (How to do this would depend on the
system that you are using)

If you want to keep your files as being essentially ascii and use
character references to access non ascii characters then you can use
either UTF-8 or iso-8859-1 as they are the same in the ascii range.

but then you want to use & # 2 2 4 ;

(without spaces)
I have tried to use &agrave; entity, but & is a reserved character. entities must be defined before use, so if you have not specified a DTD
that defines agrave to be some character you will get an undefined
entity reference error.
I have tried to use &amp;agrave;
By quoting the & you are just specifying the string"& a g r a v e ;" You
are explictly specifying that this is _not_ a reference to teh agrave
entity.
or &amp;#223;


similarly this is just the string "& # 2 2 3 ;" not a character
reference.
You want to use & not &amp; so that you get a character reference
(but 223 is sz you want 224 for a grave)

David
Jul 20 '05 #2
David Carlisle wrote:
which any XML parser will accept but in that case you would want to type
your characters using utf8 encoding.


Not quite. You need to _save_ them using UTF-8.
--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 20 '05 #3
Thanks a lot for yor careful explanation.
Unfortunately my problem persists.
Yet, maybe I am focusing...
The xsl transformation works correctly on Oxygen, my XML editing
software; à è é ì ò ù are all parsed correctly.
Yet when I open the XML page in the browser (Safari on Mac Os X) the
accented vowels turn into strange symbols.
I need to use my xml document inside the browser, since I use it to
generate dynamic content...
For some obscure reason the document doesn't work at all with Firefox
and Camino; yet it is a very simply structured xml document... When
opened with this browsers (both of them use the gecko rendering engine)
I get an error message saying that the xsl document can't be found (but
I assure you it is there!)
I am afraid something is missing in the prolog; I attach again the
prologue of xml and xsl files.
As I specified before, the xml file is actually a php file resulting
into an xml document
XML:

<?
header("Content-type: text/xml");
print '<?xml version="1.0" encoding="iso-8859-1"?>';
print'<!DOCTYPE inferno SYSTEM
"file:/Users/davidebenini/Documents/Universita%CC%8 0/Dottorato/inferno/inferno.dtd">';
print '<?xml-stylesheet type="text/xsl" href="inf-dev.xslt"?>';
?>
AND HERE THE ACTUAL XML CONTENT FOLLOWS

XSL:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:styleshe et xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
version="1.0">

Any suggestion is welcome.
Thanks again
Jul 20 '05 #4
For some obscure reason the document doesn't work at all with Firefox


Note that mozilla/firefox is much stricter about mime types and http
headers than IE. I notice that you have given your stylesheet a .xslt
extension, what mime type is it hat servered with from your server?
It will need to be an XML one otherwise mozilla will not use it as a
stylesheet.
Also notice that although youhave a dtd reference mozilla/firefox never
loads an external dtd so if that dtd is needed to define entities or
attribute defaults, these will not work in mozilla.

In either case (mozilla or iE) the encodings specified by the server in
the http headers overrule the encodings specified in <?xml ...

So your php code is writing
<?xml version="1.0" encoding="iso-8859-1"?>';
and sending the header header("Content-type: text/xml"); I don't really
know php, if that's the only header that is sent then you should be OK
as the default encoding for text/xml is iso-8859-1 so as long as your
characters really are in that encoding it should just work...

Yet when I open the XML page in the browser (Safari on Mac Os X) the
accented vowels turn into strange symbols.

If these symbols include accented capital A's that's usually a sign that
the file is in utf8 but is being read as latin1, try manually puting the
browser in utf8 encoding (view/encoding menu in IE)

David
Jul 20 '05 #5

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

Similar topics

1
3846
by: Bernhard Georg Enders | last post by:
I'm using the php 'file' command to read the contents of an ASCII text file to a variable. The original text file contains some accented and special characters. The problem arises when I echo this variable: the accented characters are messed up. And not only accented characters, for example, the special characters ª is printed as ª. What can I do to correct this issue? I have tried, without success, to use the 'setlocale' command. TIA,
1
2454
by: Fuzzyman | last post by:
I've written an anagram finder that produces anagrams from a dictionary of words. The user can load their own dictionary. ( http://www.voidspace.org.uk/atlantibots/nanagram.html ) In order to ensure it is able to find anagrams properly I wanted to strip characters like punctuation etc from words in the dictionary and words the user entered. I test(ed) against the 26 English letters ( string.ascii_lowercase ).
14
16131
by: Nicolas Bouillon | last post by:
Hi I would like to replace accentuel chars (like "é", "è" or "à") with non accetued ones ("é" -> "e", "è" -> "e", "à" -> "a"). I have tried string.replace method, but it seems dislike non ascii chars... Can you help me please ? Thanks.
2
2662
by: Remco van den Berg | last post by:
I'm running a MySQL database with one of tables holding the members of a volleybal club in the Netherlands. One the the fields in that table is holding the name of the players. How do I search for all people with the name "Andre", with the important remark, that it should also match "André"!! So with the letter "e" with an accent "'" on it. In the Netherlands those names can be spelled with and without the accent and I do not always...
2
1707
by: nicolas_riesch | last post by:
I try to use python as the language in an asp page with Microsoft IIS 5.0. I have these two files, req_bad.asp and req_ok.asp ---------- req_bad.asp --------- <%@LANGUAGE=Python%> <%
4
2032
by: Satish | last post by:
Hi Gurus, Please help me in this, I have tried all options available to me. (Option 1) I am making a simple request from VB.NET client to WBI generated WSDL and passing request parameters. The response I am expecting should have some accented characters (Customer Name: Lokalcenter Åbygård), but this gets truncated and response is as follows (Customer Name: Lokalcenter bygrd). The WSDL has utf-8 character set defined.
0
2307
by: shintu | last post by:
Hallo, I am trying to write french accented characters é è ê in Excel worksheet using my perl script , But I am stuck here as I couldnt find a way of writing it !: My code: use strict; use warnings;
2
6433
by: gsuns82 | last post by:
Hi all, I have to replace accented characters from a input string with normal plain text.I have coded as follows. String input = "ÄÀÁÂÃ"; input= input.replaceAll("", "A"); like wise v can do for all. output was: ************ AAAAA
4
2899
by: gsuns82 | last post by:
Hi all, I am facing a strange issue. i.e: I have a jsp page with an input text field where the user can enter searching value even along with Accented Characters.After that i am getting the input value at the controller inorder to compose a query,before that i am replacing Accented Characters with plain text values so that i can append the proper input value in the DBquery. I tried to replace the input string for ...
1
1989
by: gsauns | last post by:
I have an ASP.NET app in which I import from a comma-delimited text file, put all that data in a GridView, and then insert the records into multiple related tables in my SQL Server database. I got one text file which contains accented characters. When I bring them into the GridView, the accented characters show up as boxes, the universal unrecognized character. And since I am inserting into the DB by iterating thru the rows of the...
0
9595
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10600
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10354
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10097
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9175
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7642
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.