Hi,
I have an ASP.Net website, which allows users to upload a file which is
then inserted into a database.
This is all fine until it reads a line with the string +Anu in it.
It transforms this to this char É» (which, if Googled for, is
described as Unicode Character 'LATIN SMALL LETTER TURNED R WITH HOOK'
(U+027B) or, in Phonetics, as a 'Retroflex approximant'.)
Has anyone seen this behaviour before, and know how to stop it?
The code's simple - here's an example. The É» appears in the output
where the input is +Anu - it's transformed before I can touch it!
using (StreamReader sr = new StreamReader(st rFile,
System.Text.Enc oding.UTF7)) {
// Read and display lines from the file until the end of the file is
reached.
while ((line = sr.ReadLine()) != null) {
Response.Write( line);
}
}
Regards
Adam 3 1321
Looks like an encoding issue, alright.
Have you tried using the StreamReader constructor that does not require a
character encoding?
"Cy**********@g mail.com" wrote:
Hi,
I have an ASP.Net website, which allows users to upload a file which is
then inserted into a database.
This is all fine until it reads a line with the string +Anu in it.
It transforms this to this char É» (which, if Googled for, is
described as Unicode Character 'LATIN SMALL LETTER TURNED R WITH HOOK'
(U+027B) or, in Phonetics, as a 'Retroflex approximant'.)
Has anyone seen this behaviour before, and know how to stop it?
The code's simple - here's an example. The É» appears in the output
where the input is +Anu - it's transformed before I can touch it!
using (StreamReader sr = new StreamReader(st rFile,
System.Text.Enc oding.UTF7)) {
// Read and display lines from the file until the end of the file is
reached.
while ((line = sr.ReadLine()) != null) {
Response.Write( line);
}
}
Regards
Adam
Graven,
I'm not sure how a 4 letter string like this could be seen as an
encoding issue, but I will certainly give it a go. Thanks for the
suggestion.
Adam
Graven wrote:
Try to use plain latin-1 encoding. I think it's an unicode
normalization issue, but don't know if StreamReader performs it by
default. Cy**********@gm ail.com wrote:
Hi,
I have an ASP.Net website, which allows users to upload a file which is
then inserted into a database.
This is all fine until it reads a line with the string +Anu in it.
It transforms this to this char É» (which, if Googled for, is
described as Unicode Character 'LATIN SMALL LETTER TURNED R WITH HOOK'
(U+027B) or, in Phonetics, as a 'Retroflex approximant'.)
Has anyone seen this behaviour before, and know how to stop it?
The code's simple - here's an example. The É» appears in the output
where the input is +Anu - it's transformed before I can touch it!
using (StreamReader sr = new StreamReader(st rFile,
System.Text.Enc oding.UTF7)) {
// Read and display lines from the file until the end of the file is
reached.
while ((line = sr.ReadLine()) != null) {
Response.Write( line);
}
}
Regards
Adam
Larry,
You were spot on - changing to UTF8 stopped this transformation. Thanks
It's not quite solved my problem though.
The file is a Text file, each line being a series of files delimited by
the ¦ character, as this was unliekley to ever appear in the actual
data.
Unfortunately, UTF8 encoding strips these characters completely. ASCII
encoding, on the other hand, replaces them with ?
Oh the joy of character encoding.
Regards
Adam
Larry Lard wrote:
This is why you are seeing what you are seeing. UTF7 encodes characters
outside the printable 7 bit range using UTF16 then modified base64, with
+ as the indicator mark for this encoding. I haven't checked, but I
imagine +Anu is the UTF7 encoding of that character. You shouldn't use a
UTF7 reader to read a file that you don't know for sure was produced by
a UTF7 writer.
The correct way to read the file depends on what kind of file it is. If
it is text of an unknown encoding, there is no way to be absolutely
sure, but UTF8 is a good starting point. If it's binary data, you
shouldn't be using a TextReader class at all.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Anders Eriksson |
last post by:
Hello!
I'm using ActivePython 2.3.2 build 232 on Windows 2000 and I have noticed a
strange behavior in PythonWin IDE (win32all build 163)
I'm from Sweden and we have a couple of letters in our alphabet that isn't
part of ASCII and the strangeness is about one of them
When I use the letter å (å) then the next character is eaten! Then
when I enter the next character (the second after å) the last one appears.
|
by: Christopher |
last post by:
I am currently in the process of evaluating the performance hits of moving
to the .NET platform for our application. I created a sample project that
loads the transforms the same XML and XSLT in COM, COM using interop and in
C# and then transforms it to HTML. I also tried concatenating the XML and
XSL as a string and then loading it to the DOM once as opposed to loading
the DOM with the appendChild() method. I see that the C# version is...
|
by: Sam Sungshik Kong |
last post by:
Hello!
I'm testing Graphics.DrawString and it's very strange.
I created an event handler for the form.s Paint event.
(There's no other code in the form.)
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
|
by: Eps |
last post by:
My program has an ini file which i read in the settings for the program.
The main setting is the path where files are to be saved. At the
moment it doesn't work, but if I hardcode the path it does (even though
the hardcoded path is the same as the one in the ini file).
I looked at the path in a text box after it had been read in and it had
a strange character on the end, it was a slim upright rectangle, i
assume this is the source of my...
|
by: Amil |
last post by:
I am screen scraping a web page via GetResponseStream and can't resave a
certain character in the stream:
Stream respStream = wResp.GetResponseStream();
StreamReader reader = new StreamReader(respStream, Encoding.ASCII); // have
also used other UTFx modes
String respHTML = reader.ReadToEnd();
There is a strange character on the web page; it is a extra long
hypen...like the one in MS Word that is used if you type in two normal
| |
by: CyberSpyders |
last post by:
Hi,
I have an ASP.Net website, which allows users to upload a file which is
then inserted into a database.
This is all fine until it reads a line with the string +Anu in it.
It transforms this to this char É» (which, if Googled for, is
described as Unicode Character 'LATIN SMALL LETTER TURNED R WITH HOOK'
(U+027B) or, in Phonetics, as a 'Retroflex approximant'.)
|
by: annecarterfredi |
last post by:
I was getting snapshot since the database was responding very
slow...here is the query that was in a snapshot:
WITH TYPEINTS ( TYPEINT, COLTYPE ) AS ( VALUES ( SMALLINT(1 ),
CHAR( 'INTEGER', 8) ), ( SMALLINT
(2 ), CHAR( 'SMALLINT', 8) ), ( SMALLINT(3 ), CHAR( 'BIGINT',
8) ), ( SMALLINT(4 ), CHAR( 'REAL'
, 8) ), ( SMALLINT(5 ), CHAR( 'DOUBLE', 8) ), ( SMALLINT(6 ),
CHAR( 'CHAR', 8) ), ( SMA
LLINT(7 ), CHAR( 'VARCHAR',...
|
by: blumen |
last post by:
Hi all,
I'm a newbie in VB.Net Programming..
Hope that some of you can help me to solve this..
I'm working out to read,parse and save textfile into SQL Server.
The textfile contains thousands of rows with about 50 coloums every row..
Everythings goes well until I found one textfile with some strange character...seems to be Japanese character(because it's a Japanese company who owns this textfile)
|
by: Mark Morss |
last post by:
Is this the place to ask a win32com.client question? I am a unix
person trying to run on windows, so I have little familiarity with
this module. I have this code:
import win32com.client
"""An Access connection"""
def connect(data_source, user, pwd, mdw):
connAccess = win32com.client.Dispatch(r'ADODB.Connection')
|
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: 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: 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: 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: 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: 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...
| |