Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8720891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:07:52+00:00 2026-06-13T07:07:52+00:00

I have the following piece of code: Dim fecha As DateTime = DateTime.Now Using

  • 0

I have the following piece of code:

Dim fecha As DateTime = DateTime.Now
Using w As StreamWriter = File.AppendText(fichero.Text)
    w.WriteLine(fecha.ToString("dd/MM/yyyy") + vbTab + tiempo.Text + vbTab + comentario.Text)
    w.Close()
End Using

Which is called from a Windows Form in .NET 4, where tiempo and comentario are two TextBox where you get strings. The problem I have is that if I write a localized phrase with apostrophes, they appear as “ó” “é” or “í-” in the text file instead of “ó” “é” and “í”.

Any idea how can I set the function to write correctly the localized phrase?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T07:07:53+00:00Added an answer on June 13, 2026 at 7:07 am

    Instead of using File.AppendText you can create a new StreamWriter and specify whatever encoding you like. For example 1252 for Latin (Western European languages). 2’nd parameter specifies that the text should be appended to the file.

    Using writer = New StreamWriter(fichero.Text, True, Encoding.GetEncoding(1252))
        writer.WriteLine(fecha.ToString("dd/MM/yyyy") + vbTab + tiempo.Text + vbTab + comentario.Text)
    End Using
    

    Also disposing the writer will call Close (no need to explicitly call it)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following piece of code : fis = new FileInputStream(new File(st[0])); br =
I have following piece of code in my jsp file which getSession information: <jsp:useBean
I have the following piece of code: decimal kwh = decimal.Parse(textBox1.Text, NumberStyles.AllowDecimalPoint, NumberFormatInfo.CurrentInfo); decimal
I have following piece of code which tries to load an XML file from
I have following code (now compilable, thanks to @LokiAstari): To compile the following piece
I have the following piece of code that emits all my javascript: @using SquishIt.Framework.Minifiers.JavaScript
i have following piece of code with me iam spliting the words using only
I have following piece of code: It compiles without problems under gcc-3.4, gcc-4.3, intel
I have following piece of code : public Hashmap<String,String> tempmap = new HashMap<String,String>(); and
I have the following piece of code that takes in some words, stores them

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.