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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:07:40+00:00 2026-05-28T14:07:40+00:00

I get a ISO-8859-1-encoded string from an exernal DLL, and I must use it

  • 0

I get a ISO-8859-1-encoded string from an exernal DLL, and I must use it to create a link.

Apparently, in production (I have no access to the production server whatsoever), it adds “%00” at the end of the utf-8-decoded strings. I understand that it is a null-terminated string, then. How can I handle this situation ?

My conversion function is this one :

Private Function DecodeString(ByRef SourceData As String, ByVal SourceEncoding As Encoding, ByVal OutputEncoding As Encoding) As String
    Dim bSourceData As Byte() = SourceEncoding.GetBytes(SourceData)
    Dim bOutData As Byte() = System.Text.Encoding.Convert(SourceEncoding, OutputEncoding, bSourceData)
    Return OutputEncoding.GetString(bOutData)
End Function

What do I have to change to make it work ? I thought of something like .Replace("%00", "") but even if it worked, I don’t think it would solve the underlying problem…

I found this : Fastest way to convert a possibly-null-terminated ascii byte[] to a string? but I don’t want to do it “in the fastest way possible”, and I don’t like the “unsafe” part, as it is for a banking site (even if I don’t understand exactly what it can lead to, I don’t want to take any unnecessary risk).

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-05-28T14:07:41+00:00Added an answer on May 28, 2026 at 2:07 pm

    I get a ISO-8859-1-encoded string from an exernal DLL

    No, if you’ve been given a string, it’s already a sequence of Unicode characters (hand-waving around surrogate pairs aside). The fact that it may have originally been loaded from ISO-8859-1 binary data is irrelevant.

    Your method is fundamentally flawed. Assuming every character in the string can be represented in both encodings, it should be a no-op. It’s conceptually converting text to bytes in the source encoding, then converting those bytes to text, then converting that text to bytes in the target encoding, then converting those bytes to text. At best that’s a no-op; at worst it could lose data if either encoding can’t handle all the characters in the original string.

    You almost certainly need to step up a bit, to where the string is originally being constructed – that’s where the problem will be. At that point, you should probably be able to remove your method entirely.

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

Sidebar

Related Questions

I am unable to understand why I can't get a correct ISO-8859-1 charstet from
I have a file which is encoded as iso-8859-1, and contains characters such as
I've got a MySQL database table with an ISO-8859-1 encoded text field containing user
I use JSON to encode an array, and I get a string like this:
I'm parsing an external HTML page with Nokogiri. That page is encoded with ISO-8859-1.
Possible Duplicate: Calling a webservice that uses ISO-8859-1 encoding from WCF I am trying
I need get the encoding of a web page(UTF-8,ISO-8859-1,etc) before I download it because
How do I get an ISO date (2010-01-01 00:00:00), in addition to the localized
Is there any way to get the exposure settings (aperture, shutter speed, ISO) for
I receive an XML file with encoding ISO-8859-1 (Latin-1) Within the file (among other

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.