Ask the Expert

Modifying the text in the nth line using a .NET program

I have a text file and I have to modify the text in the nth line of the file using a .NET program. I tried to do this by reading line-by-line and writing it back to a new file using io.streamwriter, but it replaces characters like V?ommen to Vlkommen.
It looks like you are not accounting for internationalized characters. What you'll need to do is read up on the System.Globalization namespace and the CultureInfo class in particular. If the text file is ASCII based, you may want to strongly consider moving to UNICODE so you can handle any languages you need to handle.

This was first published in February 2004

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: