Text problem

Text problem

Anonymous
Not applicable
358 Views
3 Replies
Message 1 of 4

Text problem

Anonymous
Not applicable
When opening an ascii file using 2008 the line it reads is converted to junk.
Here is a snippet:

(setq fn (open "c:\\braintree\\a.txt" "r"))

(while (setq s (read-line fn)) ;read a.txt and create a list of the drawings

(if (= plan 1)…….rest of code

The file a.txt looks like:

H12
L12
H13

If I look at the variable s it looks like "ÿþH\0001\0002\000" instead of "H12".

Have you got any ideas?
0 Likes
359 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
When you save the txt file make sure you set encoding to ANSI and not
Unicode.

Murph

wrote in message news:5840583@discussion.autodesk.com...
When opening an ascii file using 2008 the line it reads is converted to
junk.
Here is a snippet:

(setq fn (open "c:\\braintree\\a.txt" "r"))

(while (setq s (read-line fn)) ;read a.txt and create a list of the
drawings

(if (= plan 1)...rest of code

The file a.txt looks like:

H12
L12
H13

If I look at the variable s it looks like "ÿþH\0001\0002\000" instead of
"H12".

Have you got any ideas?
0 Likes
Message 3 of 4

Anonymous
Not applicable
Can you give me an example of setting the encoding?
0 Likes
Message 4 of 4

Anonymous
Not applicable
Don't know how you are creating the txt file but if you open it in Notepad
when you saveas it gives you the option.

Murph

wrote in message news:5840898@discussion.autodesk.com...
Can you give me an example of setting the encoding?
0 Likes