Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The console is cutting off strings with null bytes #1939

Open
evandrocoan opened this issue Sep 20, 2017 · 1 comment
Open

The console is cutting off strings with null bytes #1939

evandrocoan opened this issue Sep 20, 2017 · 1 comment

Comments

@evandrocoan
Copy link

evandrocoan commented Sep 20, 2017

Summary

If you run the code on Steps to reproduce with Sublime Text build you correctly get the output:

image

But when the package is loaded by Sublime Text, and it tries to output the same contents on the Sublime Text Console Ctrl+', the output is cut after the nul bytes:

image

Expected behavior

Not cut out lines with null bytes or control characters on the Console view.

Actual behavior

It does cut out lines with null bytes or control characters on the Console view.

Steps to reproduce

  1. Create the package test.py on your Packages folder:
    # -*- coding: UTF-8 -*-
    
    import sys
    print(sys.version)
    
    list = \
    [
        "1. The next line start with a null byte: ",
        "2. \x00:7: Emergency stop ",
        "3. The line before this must start with a null byte"
    ]
    
    def test_iterator():
    
        list_iterator = list.__iter__()
    
        while True:
    
            # will fail when no more lines
            try:
                item = next(list_iterator)
    
                if "Emergency stop" in item:
                    print( "Found Emergency stop on: " + item )
    
                print( "item: " + item )
    
            except StopIteration:
                print( "On StopIteration" )
                break
    
    for item in list:
    
        if ": Emergency stop" in item:
            print( "Found Emergency stop on: " + item )
    
        print( item )
    
    # test_iterator()
  2. When Sublime Text loads it, you will see:
    3.3.6 (default, Feb  2 2017, 06:15:59) [MSC v.1600 32 bit (Intel)]
    1. The next line start with a null byte: 
    Found Emergency stop on: 2. 
    2. 
    3. The line before this must start with a null byte 
    
  3. But you should see:
    3.3.6 (default, Feb  2 2017, 06:15:59) [MSC v.1600 32 bit (Intel)]
    1. The next line start with a null byte: 
    Found Emergency stop on: 2. 
    2. NUL:7: Emergency stop 
    3. The line before this must start with a null byte 
    
    Which is the same output as when running with with the build system.

Environment

  • Operating system and version:
    • Windows 10 build 15063 x64
    • Mac OS ...
    • Linux ...
  • Monitor:
    • Resolution 1920x1080
    • dpi_scale used in ST 1.0
  • Sublime Text:
    • Build 3144
    • 32 bit

Related:

  1. Pasted text containing NULLs is truncated #393 Pasted text containing NULLs is truncated
  2. The build panel, it is severally cutting out lines of its output #1606 The build panel, it is severally cutting out lines of its output
  3. It reports No errors. No warnings. No bad boxes. when there are errors SublimeText/LaTeXTools#1230 It reports No errors. No warnings. No bad boxes. when there are errors
@FichteFoll
Copy link
Collaborator

FichteFoll commented Sep 20, 2017

This can be reproduced more easily with just print("2. \x00:7: Emergency stop "). (Arch here, ST 3144)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants