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

  • Home
  • SEARCH
  • 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 782347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:22:21+00:00 2026-05-14T20:22:21+00:00

Background. I’m working with netlists , and in general, people specify different hierarchies by

  • 0

Background. I’m working with netlists, and in general, people specify different hierarchies by using /. However, it’s not illegal to actually use a / as a part of an instance name.

For example, X1/X2/X3/X4 might refer to instance X4 inside another instance named X1/X2/X3. Or it might refer an instance named X3/X4 inside an instance named X2 inside an instance named X1. Got it?

There’s really no “regular” character that cannot be used as a part of an instance name, so you resort to a non-printable one, or … perhaps one outside of the standard 0..127 ASCII chars.

I thought I’d try (decimal) 166, because for me it shows up as the pipe: ¦.

So… I’ve got some C++ code which constructs the path name using ¦ as the hierarchical separator, so the path above looks like X1¦X2/X3¦X4.

Now the GUI is written in Tcl/Tk, and to properly translate this into human readable terms I need to do something like the following:

set path [getPathFromC++] ;# returns X1¦X2/X3¦X4
set humanreadable [join [split $path ¦] /]

Basically, replace the ¦ with / (I could also accomplish this with [string map]).

Now, the problem is, the ¦ in the string I get from C++ doesn’t match the ¦ I can create in Tcl. i.e. This fails:

set path [getPathFromC++] ;# returns X1¦X2/X3¦X4
string match $path [format X1%cX2/X3%cX4 166 166]

Visually, the two strings look identical, but string match fails. I even tried using scan to see if I’d mixed up the bit values. But

set path [getPathFromC++] ;# returns X1¦X2/X3¦X4
set path2 [format X1%cX2/X3%cX4 166 166]
for {set i 0} {$i < [string length $path]} {incr i} {
   set p [string range $path $i $i]
   set p2 [string range $path2 $i $i]
   scan %c $p c
   scan %c $p2 c2
   puts [list $p $c :::: $p2 $c2 equal? [string equal $c $c2]]
}

Produces output which looks like everything should match, except the [string equal] fails for the ¦ characters with a print line:

¦ 166 :::: ¦ 166 equal? 0

For what it’s worth, the character in C++ is defined as:

const char SEPARATOR = 166;

Any ideas why a character outside the regular ASCII range would fail like this? When I changed the separator to (decimal) 28 (^\), things worked fine. I just don’t want to get bit by a similar problem on a different platform. (I’m currently using Redhat Linux).

  • 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-14T20:22:22+00:00Added an answer on May 14, 2026 at 8:22 pm

    As I understand it, modern versions of TCL use UTF-8 internally for string representation. In UTF-8, decimal 166 is half of a character, so it’s no wonder that all hell is breaking loose. 😉

    My guess is that your C++ code is using a Latin-1 string (i.e., char *) and you’re passing that to TCL which is interpreting it as a UTF-8 string. You need to convert your C++ string to UTF-8 before passing it to any TCL C functions. TCL provides some functions for this purpose.

    You can read more about TCL and UTF-8.

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

Sidebar

Related Questions

Background I'm using SendKeys() to send keyboard commands to the active window, but I'm
Background: I'm using a delegation technique to abstract access to arbitrary object methods, but
Background: On a recent website, I'm using a jQuery driven dropdown menu in addition
background-position: -200px 0; one site says it crops an image from the bottom and
Background Looking to automate creating Domains in JasperServer. Domains are a view of data
Background This is the same background as my previous question , except the Outline
Background: I’ve inherited a project, about 10k loc implementing an odbc driver. To configure
Background I've got the following tree of objects: Name Project Users nil John nil
Background: I have a MainTest class that has many buttons, each of which instantiate
Background: I've implemented a stochastic algorithm that requires random ordering for best convergence. Doing

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.