Hi,
After writing the £ (pound sterling) symbol to a file using
StreamWriter using the default encoding UTF8, when I retrieve it the
file symbol £ gets changed. But when I use Encoding.Defaul t in the
StreamWriter, I am able to retrieve the symbol without any issue.
Can you tell me why this is so? Microsoft recommend using UTF8 for
encoding, but it does not seem to work in this case.
thanks,
Arun 1 2511
Hi Arun,
You are not saving and reading the file using the same Encoding.
If you do not specify encoding the StreamWriter/Reader will default to UTF8,
but other applications often default to the code page used by your current
locale, Encoding.Defaul t (ANSI). For instance, Notepad uses ANSI encoding if
not told otherwise.
Check your reading/writing code. If both reading and writing uses UTF8, do
other parts of your program, or other applications, create the file in
question?
--
Happy Coding!
Morten Wennevik [C# MVP]
"ar******@gmail .com" wrote:
Hi,
After writing the £ (pound sterling) symbol to a file using
StreamWriter using the default encoding UTF8, when I retrieve it the
file symbol £ gets changed. But when I use Encoding.Defaul t in the
StreamWriter, I am able to retrieve the symbol without any issue.
Can you tell me why this is so? Microsoft recommend using UTF8 for
encoding, but it does not seem to work in this case.
thanks,
Arun
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Majed |
last post by:
Hi , all
I'm trying to write unicode to a file for another app (not developed with
vs2003) to read it. I used StreamWriter with unicode encoding.but I was
surprised that the streamwriter adds FFFE to the start of the file,which
stopes the other app from reading it!!
any idea how to stope it frome doing that,do I have to use another class
#####writer that supports unicode?
help me Please!
Thanks
|
by: timtos |
last post by:
I want to save text in a file and after that I want to display this textfile
using the internet explorer.
If I am displaying "html text" everything is fine but if I want to display
plain text all characters from the extended ascii are looking weird - are
not properly encoded! Using the options in View -> Encoding -> ... in the
internet explorer I can switch to another encoding and it is displayed
correct. With the same way, I can make...
|
by: ZoombyWoof |
last post by:
Hi all. I have a c# app that sometimes writes to a textfile. Sometimes
the text contains the swedish letters åäö. In the app these letters look
ok, but when StreamWriter has written them to the file they look like
shit. Some encoding mismatch is happening here I suspect, but I cant
find it.
I run English version of XP with swedish regional settings everywhere I
can find them :-).
Any hints would be much appreciated. Thanx
|
by: kinekine |
last post by:
Hello,
i have a big problem with my email component, because each time i write the
generated message directly to the spooler, the streamwriter will write in
Unicode.
The file starts with a FF FE and is double byte.
This is a problem because when a mail server like QMAIL receive the message,
will reject for malformed LF.
|
by: LucaJonny |
last post by:
Hi,
I've got a problem using StreamReader in VB.NET.
I try to read a txt file that contains extended characters and theese
are removed from the line that is being read.
I've read a lot of articles about ANSI encoding like this
http://support.microsoft.com/default.aspx?scid=kb;en-us;889835
but System.Text.Encoding.Default don't work!!
| |
by: lprisr |
last post by:
Hi,
I have double byte characters in the content that I am returning using Web
Services. However, the encoding in the xml file returned by Web Services is
utf-8 and I am unable to read the content, not even by changing browser
encoding setting to the appropriate one.
I implemented SoapExtension (called EncodingExtension) to rewrite the xml to
change the encoding="utf-8" to encoding="windows-1252" in BeforeDeserialize
SoapMessage...
|
by: Bob |
last post by:
Hi
Need to produce a Doc with no encoding info.
Is there anyway of doing this?
Thanks
Bob
i.e.
<?xml version=\"1.0\" ?>
|
by: Diego F. |
last post by:
Hi. I'm using that code:
If File.Exists(Ls_NombreFichero) = False Then
sw = File.CreateText(Ls_NombreFichero)
Else
sw = File.AppendText(Ls_NombreFichero)
End If
I need to change the encoding, as utf-8 is not the one I can use. How can I
change it? Encoding property is read only and I don't know how to use the
|
by: Tomasz Toczyski |
last post by:
My locale is set to UTF-8. The command:
python -c "print u'\u03A9'"
gives me the desired result and doesn't produce any error.
But when I want to redirect the output to a file I invoke:
python -c "print u'\u03A9'" file.txt
I get an error:
File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u03a9' in
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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: 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...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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.
| |