jEdit Community - Resources for users of the jEdit Text Editor
Macro for removing '\0' possible?
Submitted by labidus on Friday, 9 March, 2012 - 01:20
i got a problem by using reload with encoding from UTF-16 to UTF-8, finally I reloaded with US-ASCII

My ASCI file now have a lot of wrong character, 1/2 of the character are useless, basically I need to find the bad character
and replace them with a "" empty char, to restore the file.

I say character '\0' need to be removed but its maybe another number, but the character is lower then space, so in the editor
it seam ok but you need to move the cursor 2 times to actually change to the next character.

Anyway, what i am trying to use is that right now

SearchAndReplace.setSearchString("\\0");
SearchAndReplace.setReplaceString("");
SearchAndReplace.setBeanShellReplace(false);
SearchAndReplace.setIgnoreCase(true);
SearchAndReplace.setRegexp(true);
SearchAndReplace.find(view);
SearchAndReplace.find(view);
SearchAndReplace.replace(view);

But the character \\0 generate a javascript error

thank you, btw I really like this editor, i am using it on my mac for a game project!
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Workaround
by Robert Schwenn on Fri, 09/03/2012 - 17:39
Hi, I' try to workaround the real problem first:

If You reload a file with a certain encoding, You guess that this file is already encoded with the chosen encoding. If this is not the case You destroy the file when saving (which You've done apparently).

If the buffer looks good and You want to change the encoding, then:
- change "Utilities -> Buffer Options -> Character Encoding" and
- save the file.
 
I tried a lot of thing withou
by labidus on Fri, 09/03/2012 - 21:54
I tried a lot of thing without success, so my last thing was to make a macro, without success, I ended up to make a program to remove all the bad character lol

now all my files are ok now Smiling

The problem was that the encoding from UTF-16 to 8 or ascii got corrupted and was not working well (with a /0 character 1/2).

Now all my file are ascii, all my new files will be ascii so i will no longer have this issue
User login
Browse archives
« November 2024  
MoTuWeThFrSaSu
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   101634
Context Free Art (*.cfdg)   0.31   46062
BBEdit scheme   1.0   18601
JBuilder scheme   .001   18502
ColdFusion scheme   1.0   18031
R Edit Mode - extensive version   0.1   17481
Advanced HTML edit mode   1.0   16213
Matlab Edit Mode   1.0   16075
jEdit XP icons   1.0   15236
XP icons for jEdit   1.1   14300