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 8864469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:14:55+00:00 2026-06-14T16:14:55+00:00

(using vb.net) Hi, I have an ini file where I need to post an

  • 0

(using vb.net)

Hi,

I have an ini file where I need to post an RTF file as a single line in the ini file – like…

[my section]
rtf_file_1=bla bla bla (the content of the rtf file)

To avoid linebreaks, special codes etc. in the RTF file from wrapping in the ini file, how can I encode (and decode) it as a single string?

I was thing if there was a function to convert a string (in my case the content of the RTF file) into a line of numbers and then decode it back?

What would you do?

Thanks!

  • 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-14T16:14:56+00:00Added an answer on June 14, 2026 at 4:14 pm

    You can encode them using base64 encoding. Like that the content gets treated binary –> it can be any type of file.
    But of course in the config file you wont be able to read the content of the file.

    Here a Snippet to Base64 encode / decode

    //Encode
    string filePath = "";
    string base64encoded = null;
    using (StreamReader r = new StreamReader(File.OpenRead(filePath)))
    {
        byte[] data = System.Text.ASCIIEncoding.ASCII.GetBytes(r.ReadToEnd());
        base64encoded = System.Convert.ToBase64String(data);
    }
    
    //decode --> write back
    using(StreamWriter w = new StreamWriter(File.Create(filePath)))
    {
        byte[] data = System.Convert.FromBase64String(base64encoded);
    
        w.Write(System.Text.ASCIIEncoding.ASCII.GetString(data));
    }
    

    and in VB.NET:

        Dim filePath As String = ""
        Dim base64encoded As String = vbNull
    
        'Encode()
        Using r As StreamReader = New StreamReader(File.OpenRead(filePath))
            Dim data As Byte() = System.Text.ASCIIEncoding.ASCII.GetBytes(r.ReadToEnd())
            base64encoded = System.Convert.ToBase64String(data)
        End Using
    
        'decode --> write back
        Using w As StreamWriter = New StreamWriter(File.Create(filePath))
            Dim data As Byte() = System.Convert.FromBase64String(base64encoded)
            w.Write(System.Text.ASCIIEncoding.ASCII.GetString(data))
        End Using
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to find out who created a file using .NET I have already
Using .NET I have a text file with comma separated data. One of the
sending mail along with embedded image using asp.net I have already used following but
using .NET 3.5. I have a function I want to make multithreaded calls to.
So I have a textbox in C# (Using .NET forms) where I am going
I'm using protobuf-net v2 and have a class that inherits List that I wan't
What I have created a very simple asp.net web service using .NET framework 3.5,
I have a server-side code using .NET Remoting to establish the connection with client.
I have previously written user interfaces using .NET and Windows Forms. I'm about to
I am using vb.net language I have a dropdownlist, which is filled by below

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.