473,473 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

escape characters in *.settings file

I'm having some trouble storing a string in my settings file that contains
escape characters.
If I enter "This is the first line\r\nand this is the second line."

When I retrieve the string from the settings file I get: "This is the first
line\\r\\nand this is the second line."
It seems to think it's a path or something?

Anyone else dealt with this before? I googled the problem but didn't find
anything (so far).

Thanks for any help,
Steve
Sep 25 '07 #1
2 2740
sklett wrote:
I'm having some trouble storing a string in my settings file that contains
escape characters.
If I enter "This is the first line\r\nand this is the second line."

When I retrieve the string from the settings file I get: "This is the first
line\\r\\nand this is the second line."
It seems to think it's a path or something?
It's not that it thinks it's a path. It's that you have entered a
backslash in your text in the file, and so when you look at the string
in the debugger, the debugger escapes the backslash so that it's clear
that you're looking at a backslash character rather than something else.

I admit, it can actually wind up more confusing rather than less if
you're not used to it. :) But that's the intent anyway.

Now, as for the actual problem, I'm not actually sure what settings file
you're talking about, but if you want to escape characters you're going
to have to go through and convert those escaped characters to what they
represent. For example, string.Replace() where you replace the string
"\\r\\n" with Environment.NewLine.

Pete
Sep 25 '07 #2
Hi Peter,

Thanks for the reply. I will use the Replace() method to make everything
work.

Take care,
Steve

"Peter Duniho" <Np*********@NnOwSlPiAnMk.comwrote in message
news:13*************@corp.supernews.com...
sklett wrote:
>I'm having some trouble storing a string in my settings file that
contains escape characters.
If I enter "This is the first line\r\nand this is the second line."

When I retrieve the string from the settings file I get: "This is the
first line\\r\\nand this is the second line."
It seems to think it's a path or something?

It's not that it thinks it's a path. It's that you have entered a
backslash in your text in the file, and so when you look at the string in
the debugger, the debugger escapes the backslash so that it's clear that
you're looking at a backslash character rather than something else.

I admit, it can actually wind up more confusing rather than less if you're
not used to it. :) But that's the intent anyway.

Now, as for the actual problem, I'm not actually sure what settings file
you're talking about, but if you want to escape characters you're going to
have to go through and convert those escaped characters to what they
represent. For example, string.Replace() where you replace the string
"\\r\\n" with Environment.NewLine.

Pete

Sep 25 '07 #3

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

Similar topics

2
by: Matthew Wieder | last post by:
In my previous post, I asked about a routine which prepares a string for an XPath query by taking care of escape characters. Unable to find a list, I'm now wondering assumign I enclose the...
7
by: teachtiro | last post by:
Hi, 'C' says \ is the escape character to be used when characters are to be interpreted in an uncommon sense, e.g. \t usage in printf(), but for printing % through printf(), i have read that %%...
18
by: Steve Litvack | last post by:
Hello, I have built an XMLDocument object instance and I get the following string when I examine the InnerXml property: <?xml version=\"1.0\"?><ROOT><UserData UserID=\"2282\"><Tag1...
3
by: Guadala Harry | last post by:
I'd like to know the answer to the following question so I can know what to expect with regard to other similar uses of escape characters and strings. While everything works fine - I'd like to know...
0
by: Mike Cooper | last post by:
Hi everyone, I am accessing several binary (PCL) files sequentially using a for loop. For each file I am using the fileget() command to populate the contents of the file into a string. I use...
131
by: Lawrence D'Oliveiro | last post by:
The "escape" function in the "cgi" module escapes characters with special meanings in HTML. The ones that need escaping are '<', '&' and '"'. However, cgi.escape only escapes the quote character if...
4
by: kuzure | last post by:
Dear friends, I had used php to store data to a file, for instance,"testing.txt". But there is one problem, there are funny characters occur when it store in the file. In my web page, it has...
2
by: | last post by:
I mainly work on OS X, but thought I'd experiment with some Python code on XP. The problem is I can't seem to get these things to work at all. First of all, I'd like to use Greek letters in the...
1
by: pronerd | last post by:
Hi, I was wondering if any one knows of an easy way to add escape characters to an existing string in a BASH script. I have a BASH script that is failing when a string is passed with brackets...
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
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,...
1
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...
0
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...
0
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...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.