Click here to Skip to main content
14,865,126 members
Home / Discussions / C#
   

C#

 
AnswerRe: Encryption Recommendation Pin
harold aptroot26-Feb-09 11:50
Memberharold aptroot26-Feb-09 11:50 
QuestionRegex Problem Pin
musefan26-Feb-09 8:35
Membermusefan26-Feb-09 8:35 
AnswerRe: Regex Problem Pin
PIEBALDconsult26-Feb-09 9:01
professionalPIEBALDconsult26-Feb-09 9:01 
GeneralRe: Regex Problem Pin
musefan26-Feb-09 10:15
Membermusefan26-Feb-09 10:15 
AnswerRe: Regex Problem Pin
Luc Pattyn26-Feb-09 11:01
sitebuilderLuc Pattyn26-Feb-09 11:01 
GeneralRe: Regex Problem Pin
PIEBALDconsult26-Feb-09 12:46
professionalPIEBALDconsult26-Feb-09 12:46 
GeneralRe: Regex Problem Pin
musefan26-Feb-09 23:53
Membermusefan26-Feb-09 23:53 
AnswerRe: Regex Problem Pin
Luc Pattyn27-Feb-09 1:26
sitebuilderLuc Pattyn27-Feb-09 1:26 
Hi musefan,

whne you read text from a file, an encoding is used; you can specify one explicitly, most methods (e.g. File.ReadAllText) allow you to specify one; or you get your system's default encoding implicitly, which depends on regional settings.

I expect the regional setting ("code page") to be such that a lot of special characters get encoded in the byte value range [0x80, 0xFF], in order to save bytes in a file (and make it region-dependent!).
As an example, in Western Europe the default code page is 1252, which puts the Euro sign at 0x80, although there also is a Unicode character for it (0x20AC). So by default, reading a file containing 0x80 will result in a string with a 0x20AC at that position.

No, Regex does not work on files or streams, it needs a string.

No, progress indication is not really possible when you ask for a bulk operation such as File.ReadAllLines, a Regex operation, an SQL database operation, etc. Progress indication is available only when you implement it, which implies there are many steps in the job, possibly forcing you to cut the job in small steps (and forego the big methods such as ReadAllLines, and all Regex stuff).

I'm not a very big fan of Regex for your needs, I would have coded that with direct byte or char manipulations on the stream. Not sure whether I would chose bytes or chars though, probably bytes since your file does not really qualify as text, due to the 0xFF stuff.

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles]

- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets


modified on Sunday, June 12, 2011 8:43 AM

GeneralRe: Regex Problem Pin
musefan27-Feb-09 1:44
Membermusefan27-Feb-09 1:44 
AnswerRe: Regex Problem Pin
Luc Pattyn27-Feb-09 1:51
sitebuilderLuc Pattyn27-Feb-09 1:51 
GeneralRe: Regex Problem Pin
musefan27-Feb-09 2:06
Membermusefan27-Feb-09 2:06 
GeneralRe: Regex Problem Pin
PIEBALDconsult27-Feb-09 4:36
professionalPIEBALDconsult27-Feb-09 4:36 
QuestionBy-passing certification validation for Webservice Pin
satsumatable26-Feb-09 8:13
Membersatsumatable26-Feb-09 8:13 
QuestionIntptr and dll Pin
Alessio Granzotto26-Feb-09 8:08
MemberAlessio Granzotto26-Feb-09 8:08 
AnswerRe: Intptr and dll Pin
Curtis Schlak.26-Feb-09 8:29
MemberCurtis Schlak.26-Feb-09 8:29 
GeneralRe: Intptr and dll Pin
Alessio Granzotto26-Feb-09 8:33
MemberAlessio Granzotto26-Feb-09 8:33 
QuestionC# or autoit Pin
alwaysthinking26-Feb-09 7:10
Memberalwaysthinking26-Feb-09 7:10 
AnswerRe: C# or autoit Pin
Calin Tatar26-Feb-09 7:45
MemberCalin Tatar26-Feb-09 7:45 
GeneralRe: C# or autoit Pin
alwaysthinking26-Feb-09 7:48
Memberalwaysthinking26-Feb-09 7:48 
GeneralRe: C# or autoit Pin
Curtis Schlak.26-Feb-09 8:32
MemberCurtis Schlak.26-Feb-09 8:32 
QuestionHow to map DataGridView.Column.HeaderText to DataColumn.Caption property. Pin
hdv21226-Feb-09 5:52
Memberhdv21226-Feb-09 5:52 
QuestionFlow Options opinions Pin
ffowler26-Feb-09 5:51
Memberffowler26-Feb-09 5:51 
AnswerRe: Flow Options opinions Pin
Ennis Ray Lynch, Jr.26-Feb-09 7:05
MemberEnnis Ray Lynch, Jr.26-Feb-09 7:05 
GeneralRe: Flow Options opinions Pin
ffowler26-Feb-09 7:15
Memberffowler26-Feb-09 7:15 
GeneralRe: Flow Options opinions Pin
Ennis Ray Lynch, Jr.26-Feb-09 7:18
MemberEnnis Ray Lynch, Jr.26-Feb-09 7:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.