Hi all,
I posted a couple of weeks ago with what I thought was a problem with
the file system reading accented characters however, after debugging
line by line I have now found the true problem.
I am storing a list of files in an XML file as a sort of database.
Some of these filenames have accented characters (i.e. á é í ó ú
or ñ). However, upon writing the filename to the XML file, the
accented character is dropped. This causes a problem upon re-reading
the filenames because the program can not find the files because their
'saved' filename is now different. For example, the word "más" is
saved in the XML file as "ms".
Any ideas how I can work around this? I could strip out the accents
and replace them with their "normal" equivalent i.e. á becomes a. But
this is a sort of bodge fix as I will lose the link to the original
file. Also, I can see a scenario where a file may get overwritten
because the modified filename is the same as an existing file perhaps.
So, to put it blunty, I'm stuck! Help!
Thanks
Jan 9 '06
16 3430
The code pages are not per country, but for greater regions or alphabets.
For example, western european languages use code page 1252 (ANSI Latin I) if
I remember correctly. So, if you are exchanging data from, say, France to
Spain, it will work. China or Russia would be a problem, though.
Also, if you know the code page that was used to create the file, you can
create your own encoding instead of using "Default":
new System.Text.Enc oding(codepage)
and pass it to your reader.
If you want to avoid the code page mess, then the writer and the reader
should use Unicode, which was invented to avoid this kind of problems.
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio 2005, Visual Studio .NET,
VB6, VB5 and VBA
You can code, design and document much faster in VB.NET, C#, C++ or VJ#
Free resources for add-in developers: http://www.mztools.com
"Hugh Janus" <my************ *@hotmail.com> escribió en el mensaje
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Ah, well there is a problem. I am developing on a computer that is set
to Spanish regional settings but the app very possibly could be
installed on a computer with different regional settings. Is there a
universal one I could use?
> The code pages are not per country, but for greater regions or alphabets. For example, western european languages use code page 1252 (ANSI Latin I) if I remember correctly. So, if you are exchanging data from, say, France to Spain, it will work. China or Russia would be a problem, though.
Also, if you know the code page that was used to create the file, you can create your own encoding instead of using "Default":
new System.Text.Enc oding(codepage)
and pass it to your reader.
If you want to avoid the code page mess, then the writer and the reader should use Unicode, which was invented to avoid this kind of problems.
:-O Carlos, I am impressed! here, have another MVP!
I think my safest option is to use unicode as China is one of the
markets that might be targeted in the future.
This raises one other question. If unicode was invented to avoid all
this, then what is the benefit of NOT using unicode?
"Hugh Janus" <my************ *@hotmail.com> escribió en el mensaje
news:11******** *************@g 44g2000cwa.goog legroups.com... I think my safest option is to use unicode as China is one of the markets that might be targeted in the future.
Yes, the safest is to use Unicode.
This raises one other question. If unicode was invented to avoid all this, then what is the benefit of NOT using unicode?
Unicode has the drawback that it increases the size of file since it uses 2
bytes per character, compared to 1 byte per character when using code pages.
It is the price to pay to accommodate all the characters of all
alphabets.... So, NOT using unicode has the benefit of using smaller files.
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio 2005, Visual Studio .NET,
VB6, VB5 and VBA
You can code, design and document much faster in VB.NET, C#, C++ or VJ#
Free resources for add-in developers: http://www.mztools.com
You may also enjoy this article:
The Absolute Minimum Every Software Developer Absolutely, Positively Must
Know About Unicode and Character Sets (No Excuses!) http://www.joelonsoftware.com/articles/Unicode.html
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio 2005, Visual Studio .NET,
VB6, VB5 and VBA
You can code, design and document much faster in VB.NET, C#, C++ or VJ#
Free resources for add-in developers: http://www.mztools.com
> The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) http://www.joelonsoftware.com/articles/Unicode.html
Carlos, this is superb. Thanks. However, when I read the filenames in
via StreamReader, I add them into a hashtable. Some of the filenames
are getting added to the hashtable as just
"?????????????? ??????????????? " which when written back via
StreamWriter become what looks like chinese characters.
Any ideas?
p.s. I have specified the same enconding for both writer and reader.
don't worry, i solved it. it was a typo.
One last thing: the 2 bytes per character for storage that I said is only
when you save as Unicode UTF-16, saving in UTF-8 consumes less space.
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio 2005, Visual Studio .NET,
VB6, VB5 and VBA
You can code, design and document much faster in VB.NET, C#, C++ or VJ#
Free resources for add-in developers: http://www.mztools.com
"Hugh Janus" <my************ *@hotmail.com> escribió en el mensaje
news:11******** **************@ o13g2000cwo.goo glegroups.com.. . don't worry, i solved it. it was a typo. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Toffe |
last post by:
Hi,
I've got a problem with regular expressions and strings containing
Swedish characters (åäö).
I basically have a PHP script that highlights certain words in a text. I
found the code attached below in the commented manual at php.net. It
works great for all words that do not contain Swedish characters. The
words that do contain åäö will not be highlighted.
|
by: JJY |
last post by:
Hi.
I have an ASP page. In there, I retirieve some data (Korean characters for
testing purpose) from the database and I tried to display it. If I set the
session.codepage = 949, the foreign characters dodn't display correctly. If
I set session.codepage = 1252, which is English (US), the foreign characters
display fine in a combo box.
Please, please, please give me your thoughts.
|
by: dalei |
last post by:
I like to make foreign letters to appear in the textarea. For
instance, when typing the letter 'a' on the keyboard, the Japanese
letter &#+12449; would appear in the textarea.
Could somebody insert a simple code in following program? I will
follow suit from there.
<style>
body { font-family:arial;}
textarea { font-family:"lucida sans unicode"; }
|
by: Xah Lee |
last post by:
the Journey of Foreign Characters thru Internet
Xah Lee, 20051101
There's a bunch of confusions about the display of non-ascii characters
such as the bullet "•". These confusions are justifiable, because the
underlying stuff is technology, computing technologies, are in a laymen
sense, extremely complex.
In order to be able to type the bullet char, post it to a newsgroup,
|
by: Harley |
last post by:
im working on an ASP.NET app in VB.NET and have problems with foreign
characters.
everything works ok, special characters are presented ok onscreen when typed
in the body of the page, using html encoding or not, i.e.
á and á both display an a with an acute symbol
the problem come when is pass foreign characters using parameters and get
the using Server.Params or Request.QueryString, they simply disappear.
| |
by: =?Utf-8?B?R2VyaGFyZA==?= |
last post by:
I get an error on a .net 2.0 page when I use foreign characters, such as ç or
ã. Setting validateRequest=false handles this, but is there a way to keep
validateRequest=true but allow foreign characters? I don't see how these
would be dangerous (am I missing something here?).
|
by: niklang |
last post by:
Hi everybody,
I have an ASP page that uses the MSXML2.ServerXMLHTTP object to read a stylesheet from IIS as follows:
strXSLPath = "http://localhost/ej/ejdetail.xsl.asp"
Dim oXMLHttpStyle
Set oXMLHttpStyle = Server.CreateObject("MSXML2.ServerXMLHTTP")
oXMLHttpStyle.open "GET", strXSLPath, False
oXMLHttpStyle.setRequestHeader "Content-Type", "text/xml"
|
by: MitchellEr |
last post by:
I can't seem to get consistency in my application with foreign character handling. I'm creating a series of forms that update database tables. So, when trying to edit a form, the field values that show up are queried from the database.
Occasionally, some fields will contain foreign characters - like ü, ã, é.
The Session.Codepage is set to 65001.
The charset also is set in the HTML code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML...
|
by: Matt |
last post by:
I originally posted this in microsoft.public.sqlserver.server, and it
was suggested that I post here.
I'm having problems with searches via a classic ASP front-end of terms
including foreign characters. For example, Profiler indicates that a
search for: ×ÓÅ ÏË, ÀÚÁÊ ÎÁ ÚÄÏÒÏ×ØÅ
is actually executed as:
SELECT top 1 '1' from dbo.mytable where contains(myfield,
'"все ок, юзай
|
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...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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,...
|
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...
|
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...
|
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...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |