file.write() need bytes when file is opened in binary mode
diff --git a/bindings/const_generator.py b/bindings/const_generator.py
index 0b97622..1ed303f 100644
--- a/bindings/const_generator.py
+++ b/bindings/const_generator.py
@@ -66,11 +66,12 @@
 
 def gen(lang):
     global include, INCL_DIR
+    print('Generating bindings for', lang)
     templ = template[lang]
     for target in include:
         prefix = templ[target]
-        outfile = open(templ['out_file'] %(prefix), 'w')
-        outfile.write(templ['header'] % (prefix))
+        outfile = open(templ['out_file'] %(prefix), 'wb')   # open as binary prevents windows newlines
+        outfile.write((templ['header'] % (prefix)).encode("utf-8"))
 
         lines = open(INCL_DIR + target).readlines()
 
@@ -79,8 +80,9 @@
             line = line.strip()
 
             if line.startswith(MARKUP):  # markup for comments
-                outfile.write("\n%s%s%s\n" %(templ['comment_open'], \
-                            line.replace(MARKUP, ''), templ['comment_close']))
+                outfile.write(("\n%s%s%s\n" %(templ['comment_open'], \
+                                              line.replace(MARKUP, ''), \
+                                              templ['comment_close']) ).encode("utf-8"))
                 continue
 
             if line == '' or line.startswith('//'):
@@ -108,7 +110,7 @@
                     try:
                         count = int(rhs) + 1
                         if (count == 1):
-                            outfile.write("\n")
+                            outfile.write(("\n").encode("utf-8"))
                     except ValueError:
                         if lang == 'ocaml':
                             # ocaml uses lsl for '<<', lor for '|'
@@ -118,9 +120,9 @@
                             if rhs[0].isalpha():
                                 rhs = '_' + rhs
 
-                    outfile.write(templ['line_format'] %(f[0].strip(), rhs))
+                    outfile.write((templ['line_format'] %(f[0].strip(), rhs)).encode("utf-8"))
 
-        outfile.write(templ['footer'])
+        outfile.write((templ['footer']).encode("utf-8"))
         outfile.close()
 
 def main():
diff --git a/bindings/ocaml/arm_const.ml b/bindings/ocaml/arm_const.ml
index cb3e4ae..ac18b0e 100644
--- a/bindings/ocaml/arm_const.ml
+++ b/bindings/ocaml/arm_const.ml
@@ -69,6 +69,7 @@
 let _ARM_SYSREG_CONTROL = 278;;
 
 (* The memory barrier constants map directly to the 4-bit encoding of *)
+
 (* the option field for Memory Barrier operations. *)
 
 let _ARM_MB_INVALID = 0;;
diff --git a/bindings/python/capstone/arm_const.py b/bindings/python/capstone/arm_const.py
index 5800274..7411308 100644
--- a/bindings/python/capstone/arm_const.py
+++ b/bindings/python/capstone/arm_const.py
@@ -69,6 +69,7 @@
 ARM_SYSREG_CONTROL = 278
 
 # The memory barrier constants map directly to the 4-bit encoding of
+
 # the option field for Memory Barrier operations.
 
 ARM_MB_INVALID = 0