Problems with nested comments and figures

Now this problem is probably too localized, but I do not see anywhere else to get help solving it. I have a large amount of important files, and these stopped compiling after switching from MikTex to TexLive (I reinstalled windows) after some fiddling I found out that some of the figures halt the compilation

\documentclass[10pt]{article}
\usepackage{tikz,tkz-euclide}
\usepackage{comment}
\usepackage{kantlipsum}
\includecomment{foo}
\includecomment{fuu}
\includecomment{figurer}
\begin{document}
\begin{foo}
\kant[1]
\begin{fuu}
\kant[3]
\begin{figurer}
\begin{figure}[!htbp] \centering
\begin{tikzpicture}
\tikzset{venn circle/.style={draw,circle,minimum width=6cm,fill=#1,opacity=0.4}}
\begin{scope}
\node (D) at (2,4) {$\overline{\,F\,}\cap\overline{\,J\,}=2$};
\end{scope}
\node (C) at (2,0) {};
\tkzDrawCircle[R,fill=gray,opacity=0.4](C,5.25cm)
\node [venn circle = red] (A) at (0,0) {};
\node [venn circle = blue] (B) at (0:4cm) {};
\node at (barycentric cs:A=1/2,B=1/2) {$F\cap J=10$};
\node  at (0,0) {$J=16$};
\node  at (0:4cm) {$F=8$};
\end{tikzpicture}
\end{figure}
\end{figurer}
\kant[4]
\end{fuu}
\end{foo}
\end{document}


Here is a somewhat minimal example, if the tikzpicture is change to something simpler like a line, the file compiles just fine.

Now, my question is how do I get nested comments and the tikzpicture enviroment to become friends for all types of plots and diagrams?

-
I am using TL2012 in Ubuntu and had no problems. I am using the csv-Version of TikZ –  Marco Daniel Aug 5 '12 at 12:04
I'm using TL2012 on cygwin/windows and get no error. What error do you get? –  David Carlisle Aug 5 '12 at 17:28

A bit of digging reveals that the issue is not to do with TikZ, etc., but to do with how the file reading/writing is working here. You can get the same issue with TeX Live on Windows with the demo file

\documentclass{article}
\usepackage{comment}
\includecomment{foo}
\includecomment{fuu}
\includecomment{figurer}
\begin{document}
\begingroup
\tracingall
\begin{foo}
\begin{fuu}
\begin{figurer}
A%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
B%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
C%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
D%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
E%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
F%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
G%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
H%%%%%
\end{figurer}
\end{fuu}
\end{foo}
\endgroup
\end{document}


It is the number of characters that causes the issue, not the content (hence the fact that % shows the problem).

I reported this on the TeX Live mailing list, and the issue is the way that TeX Live's implementation of \input is coded on Windows. Akira Kakuto, who actually compiles the W32 binaries, said

Confirmed. I can update TL2012 W32 binaries by fixed ones if needed and allowed. (pdftex, tex, aleph and luatex). In W32, input_line() is a bit different to skip byte order marks. By removing the difference, the error disapears.

There should be an update for TeX Live to fix this.

-