CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Location
    London
    Posts
    515

    Unicode replace...?

    Hi,

    I'm retrieving a product write up from an external system, the write up often contains invalid characters that don't display correctly in my UI. The characters are GRAVE ACCENT and ACUTE ACCENT, which translate to unicode 145 and 146 - they just turn into square boxes.

    How can I replace the characters in a string, is there a regular expression that can do this specific task..? Or is it something like...

    Code:
        _writeUp.Replace("\u00145", "'");
        _writeUp.Replace("\u00146", "'");
    Thanks
    If it helped, then please rate the post by clicking "Rate this post"!

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: Unicode replace...?

    The \u or \U escape sequence expects a 2 byte hexadecimal digit:
    Code:
    _writeUp = _writeUp.Replace("\u0091", "'");
    _writeUp = _writeUp.Replace("\u0092", "'");
    - petter

  3. #3
    Join Date
    Aug 2003
    Location
    London
    Posts
    515

    Re: Unicode replace...?

    That worked - thanks...
    If it helped, then please rate the post by clicking "Rate this post"!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured