User Profile

Collapse

Profile Sidebar

Collapse
firepol
firepol
Last Activity: Aug 13 '09, 07:19 PM
Joined: Mar 2 '09
Location: Basel, Switzerland
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • firepol
    replied to method with method name as parameter
    tlhintoq: thanks for your 2 cents... Well I spent a few hours reading about delegates and events... but I don't see, in practice, how I can use them in my example explained in the post :-( or... it seems very complicated.

    If I've understood your post you suggest me to create a MethodStarted event. Seems a good idea, but then... should I create also a MethodStopped event?

    I will check again some events tutorials and see...
    See more | Go to post

    Leave a comment:


  • firepol
    started a topic method with method name as parameter

    method with method name as parameter

    Hello,

    as "exercise" (I needed it) I've built a simple logging/tracing classLibrary and I'm using it to write in a txt what my application is doing, and save the exceptions.

    I'm not an expert programmer and I want to improve my library. Actually to trace something I have to do like this:

    Code:
    Logger log = new Logger();
    SomeMehod();
    log.Trace("I usually write a comment here, such as: So
    ...
    See more | Go to post

  • firepol
    replied to how to convert UTF8 file into ANSI?
    In your case, your default windows encoding is ASCII, probably because you are from the US (no accented letters). In Switzerland (where I come from) or Germany it's ANSI 1250.

    Did you try to save this as ASCII? "éàèüöä" (I guess you can't, you have to save it as UTF8)
    See more | Go to post

    Leave a comment:


  • firepol
    replied to how to convert UTF8 file into ANSI?
    Coool I found the solution!!! My initial code was not so wrong.

    What was wrong is that I can't specify the encode in the streamwriter Write() method, but it's possible to specify it when you instantiate the StreamWriter object! So definitively the key to the problem was to write the file with the correct encoding, with streamwriter. No need to convert it before, if you do not specify the encoding, streamwriter writes it anyway in UTF8....
    See more | Go to post

    Leave a comment:


  • firepol
    replied to how to convert UTF8 file into ANSI?
    corrections

    By the way, my previous code is wrong... It doesnt seem possible to tell Streamwriter which encoding to use... so, I tried like this, but still no success:

    Code:
    string filePath = "c:\\test.txt";
    
    StreamReader fileStream = new StreamReader(filePath);
    string fileContent = fileStream.ReadToEnd();
    Encoding fileEncoding = fileStream.CurrentEncoding;
    fileStream.Close();
    ...
    See more | Go to post

    Leave a comment:


  • firepol
    replied to how to convert UTF8 file into ANSI?
    I need ANSI, because a third party application can read only ANSI encoded. I've already tried with ASCII, but it doesn't work (ascii converts accented letters in "?")...

    I tried also with GetEncoding(125 0) or other code types, no way...
    See more | Go to post

    Leave a comment:


  • firepol
    started a topic how to convert UTF8 file into ANSI?

    how to convert UTF8 file into ANSI?

    Hello there, I am dealing with files encoded in UTF8 and I can't find a way to convert them into ANSI.

    I've already searched in google for this since a while, and I'm not achieving the result I want to achieve if I use the code I've found on the web, which is the following:

    Example of test.txt (save it as UTF8): "éàèüöä"

    Code:
    string filePath = "c:\\test.txt";
    
    StreamReader fileStream
    ...
    See more | Go to post
No activity results to display
Show More
Working...