I'm a beginner in App development for Android. My question is pretty simple. I can't seem to find out if the xml files in the layout folder should start with:
<?xml version="1.0" encoding="utf-8"?>
When i made a starter project, it wasn't there. But I'm also reading a book which says it should be there?
What is the correct way?
Well this declaration should not be tagged with android but it is rather an xml
syntax. It defines the XML version (1.0) and the encoding used (utf-8 = (8-bit Unicode Transformation Format)).
XML documents can contain non ASCII characters, like Norwegian æ ø å , or French ê è é.
To avoid errors,the XML encoding is specified,and files are saved Unicode.
These are some other examples of xml headers, that you can experiment with or study about :
<?xml version="1.0" encoding="us-ascii"?>
<?xml version="1.0" encoding="windows-1252"?>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-16"?>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With