Skip to content

String termination on Linux #59224

Closed
Closed

Description

@jjanis
mannequin
BPO 15019
Nosy @birkenfeld, @terryjreedy, @amauryfa, @ezio-melotti, @bitdancer

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2013-03-28.10:08:29.126>
created_at = <Date 2012-06-06.14:47:44.729>
labels = ['interpreter-core', 'type-bug']
title = 'String termination on Linux'
updated_at = <Date 2013-03-28.10:08:29.124>
user = 'https://bugs.python.org/jjanis'

bugs.python.org fields:

activity = <Date 2013-03-28.10:08:29.124>
actor = 'georg.brandl'
assignee = 'none'
closed = True
closed_date = <Date 2013-03-28.10:08:29.126>
closer = 'georg.brandl'
components = ['Interpreter Core']
creation = <Date 2012-06-06.14:47:44.729>
creator = 'jjanis'
dependencies = []
files = []
hgrepos = []
issue_num = 15019
keywords = []
message_count = 5.0
messages = ['162413', '162414', '162538', '162902', '185416']
nosy_count = 6.0
nosy_names = ['georg.brandl', 'terry.reedy', 'amaury.forgeotdarc', 'ezio.melotti', 'r.david.murray', 'jjanis']
pr_nums = []
priority = 'normal'
resolution = 'works for me'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue15019'
versions = ['Python 2.7']

Activity

  1. jjanis commented on Jun 6, 2012

    jjanismannequin
    MannequinAuthor
    test = "Hi there :)"
        print len(test), test // Prints "11 Hi there :)"
        test = test.replace(" ", "\x00")
        print len(test), test // Prints "11 

    On Windows '\x00' is same as ' ', but on linux string is terminated at first occurance of '\x00'. Results on problems with pySerial and binary data, so I can't replace '\x00' with ' '.

  2. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    type-bugAn unexpected behavior, bug, or error
    on Jun 6, 2012
  3. bitdancer commented on Jun 6, 2012

    @bitdancer
    Member

    Windows makes \x00 a space? How odd.

    This is the result for me on linux:

    Python 2.7.3+ (2.7:1f5d2642929a, May 25 2012, 12:47:34) 
    [GCC 4.5.3] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> test = "Hi there :)"
    >>> print len(test), test
    11 Hi there :)
    >>> test = test.replace(" ", "\x00")
    >>> print len(test), test
    11 Hithere:)

    Your comment on the last line of your example seems to have been truncated, so I'm not sure what you really saw.

  4. terryjreedy commented on Jun 8, 2012

    @terryjreedy
    Member

    Jānis, please present examples as proper python -- indentation and comment char -- so others can copy/paste to run without editing.
    In Idle (tkinter -- tk), '\0' is displayed as a wider space than ' '. The console is fixed pitch, so it cannot do that.

    I suspect that the response of a window to \0 is window system dependent and probably out of our control. If so, this issue should be closed.

  5. changed the title [-]Sting termination on Linux[/-] [+]String termination on Linux[/+] on Jun 8, 2012
  6. amauryfa commented on Jun 15, 2012

    @amauryfa
    Contributor

    Jānis:

    Prints "11

    This is not what I get on Linux: I see "11 Hithere:)" because the console chooses to not print the \x00. The character is present in the output stream though.

    Did you really got a truncated output? How did you run the above script?

  7. birkenfeld commented on Mar 28, 2013

    @birkenfeld
    Member

    Closing due to lack of response.

  8. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions