Author Topic: Auto-inserting NUL  (Read 1704 times)

jporkkahtc

  • Senior Community Member
  • Posts: 1717
  • Hero Points: 170
  • Text
Auto-inserting NUL
« on: June 11, 2013, 01:35:27 am »
I'm editing an android resource file
     <CR>
at the end of some of the lines.
The <CR> is a light grey color.

When I duplicate a line, the new line gets:
     <NUL>
at the end of the line.

Though, I'm pretty sure the file is in fact ANSI, 8-bit character.
(When I reload with the binary encoding option, I can see it really is 8-bit character).

Anyways, the file looks like this:

Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<resources><CR>
<CR>
    <string name="local_string_1">SnapCam</string><CR>
</resources>


Anyways, I put the cursor on the <String> line, copy - n - paste to duplicate that line.
A new line is inserted above the old, not intented and now with a <NUL>


Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<resources><CR>
<CR>
<string name="local_string_1">SnapCam</string><NUL>
    <string name="local_string_1">SnapCam</string><CR>
</resources>

jporkkahtc

  • Senior Community Member
  • Posts: 1717
  • Hero Points: 170
  • Text
Re: Auto-inserting NUL
« Reply #1 on: June 11, 2013, 01:39:42 am »
The problem appears to be because the <CR> lines have a line ending of
    0d 0d 0a
This double-CR thing appears a bunch in Android code on Windows.
"adb logcat" for instance dumps all text this way.
I don't know why my strings.xml file ended up this way, presumably because ADT made it so.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1035
  • Hero Points: 88
Re: Auto-inserting NUL
« Reply #2 on: June 11, 2013, 01:45:34 pm »
Reproduced it, we'll take a look at it.

Matthew

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 990
  • Hero Points: 44
Re: Auto-inserting NUL
« Reply #3 on: June 11, 2013, 01:50:28 pm »
We had another user report the same problem a couple weeks back where Android resource files were getting this mixed line ending issue.

You can fix this is SE a couple ways, but I find the quickest is to do a command-line replacement to get you to a sane line ending.
Code: [Select]
c/\13\13\10/\13\10/r*

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1035
  • Hero Points: 88
Re: Auto-inserting NUL
« Reply #4 on: June 12, 2013, 05:40:48 pm »
The underlying problem that caused the <CR> to be replaced with <NUL> has been fixed for the next drop.