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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:04:03+00:00 2026-05-27T05:04:03+00:00

I have a curious problem. When I copy a cell (or a row) that

  • 0

I have a curious problem. When I copy a cell (or a row) that have spaces in groups of 2 or more, when I paste this spaces are replaced with non-breaking character (Alt+160). What is more curious is that if I paste on Word then copy from Word and paste again on my program the spaces are returned, but if I paste on Excel then copy from Excel and paste on my program the non-breaking characters are still there. Obviously, the easy way is not our way, we need to copy/paste to/from Excel.

I can control on my application the introduction of this character an replace it with spaces, suposing (what is never a good idea) that nobody would introduce non-breaking characters intentionally. But we work with another application in VB 6.0 with more than 200 windows, and I don’t have my boss’s permition for change anything on that app.

I’ve debugged my code and the datagrid doesn’t have the non-breaking character. The clipboard doesn’t have any non-breaking character after the copy. And if I copy the same text from a textbox no spaces are replaced with non-breaking characters at pasting.
this is the axml of one column of any of my datagrids:

<DataGridTextColumn Header="Machine" CanUserSort="True" IsReadOnly="True" 
          MinWidth="10" Width="*" MaxWidth="Infinity" 
          Binding="{Binding Path=NOM_MAQ}">
    <DataGridTextColumn.ElementStyle>
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="ToolTip" Value="{Binding Path=NOM_MAQ}"/>
            <Setter Property="TextTrimming" Value="CharacterEllipsis"/>
            <Setter Property="TextWrapping" Value="NoWrap"/>
        </Style>
    </DataGridTextColumn.ElementStyle>
</DataGridTextColumn>

I tried adding to the DataGridTextColumn a converter:

ClipboardContentBinding="{Binding Path=NOM_MAQ, 
                          Converter={StaticResource QuitNonBreakingConverter}}"

class QuitNonBreakingConverter : IValueConverter
{
     public object Convert(object value, Type targetType, object parameter, 
                           CultureInfo culture)
     {
         string texto = value.ToString();
         StringBuilder sb = new StringBuilder(texto.Length);
         foreach (char c in texto.ToCharArray())
         {
              if (char.Equals(c, System.Convert.ToChar(160)))
              {
                   sb.Append(System.Convert.ToChar(32));
              }
              else sb.Append(c);
         }
         return sb.ToString();
     }

     public object ConvertBack(object value, Type targetType, 
                               object parameter, CultureInfo culture)
     {
         return value;
     }
}

But as I said before, the datagrid nor the clipboard have the non-breaking character, so this converter is futile.

Any idea on how to prevent this replace of characters??

  • 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-27T05:04:04+00:00Added an answer on May 27, 2026 at 5:04 am

    have you looked at all of the data flavors on the clipboard?

    the plain string might not have the nonbreaking character, but one of the other more specific kinds might? in word/excel do “paste special” to see what other formats are available, or enumerate them in code.

    I’m betting there are multiple kinds of data on the clipboard, and word prefers one and excel favors the other, and you’re getting just the plain text string in your code?

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

Sidebar

Related Questions

I'm curious how others have solved this problem, and what problems might lurk behind
I have a curious little problem. I have a service that needs to create
I seem to have a curious problem. I set up OpenGL like this: glViewport(0,
I have a rather curious problem. I have a view that I'm animating with
I have a curious problem that I hope is something stupid I overlooked. I
I have a curious problem with IE, IIS 6.0 dynamic PNG files and I
I have a curious problem: My app is distributed through ClickOnce. I recently installed
So, I am seeing a curious problem. If I have a function // counter
Ever since I started programming this has been something I have been curious about.
I have a curious problem, I need to analyze a Java heap dump (from

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.