[swift-users] emoji in source code failed to compile in linux ubuntu

Alex Blewitt alex.blewitt at gmail.com
Fri Dec 4 04:46:59 CST 2015


If you run the XXD command it will print out the hex values, which is the important thing (as opposed to a screenshot which doesn’t have that information). For example, it might be using UTF-16 or some other variation.

Can you open Terminal and run 

xxd < test.swift

and then copy/paste the text into a mail response? Then we can figure out what’s wrong.

Thanks,

Alex

> On 4 Dec 2015, at 11:41, Bee <bee.ography at gmail.com> wrote:
> 
> Here's the screen capture: http://i.imgur.com/0ud0hE4.png <http://i.imgur.com/0ud0hE4.png>
> 
> 
> On Fri, Dec 4, 2015 at 1:29 PM, Dmitri Gribenko <gribozavr at gmail.com <mailto:gribozavr at gmail.com>> wrote:
> Hi Bee,
> 
> On Thu, Dec 3, 2015 at 9:00 PM, Bee <bee.ography at gmail.com <mailto:bee.ography at gmail.com>> wrote:
> >
> > Hi,
> >
> > Just successfully installed Swift on my Linux machine. It went well and a Hello World program compiled successfully. However, when I tried to put an emoji inside of the string, it failed compiling. The error message is:
> >
> > $ swiftc test.swift
> > test.swift:1:32: error: invalid UTF-8 found in source file
> 
> This might be a clue... how did you insert the emoji?
> 
> > print("Hello World from Swift! ")
> > test.swift:1:35: error: invalid UTF-8 found in source file
> > print("Hello World from Swift! ")
> > test.swift:1:1: error: 'print' is unavailable: Please wrap your tuple argument in parentheses: 'print((...
> > ))'
> > print("Hello World from Swift! ")
> > Swift.print:2:13: note: 'print' has been explicitly marked unavailable here
> > public func print<T>(_: T)
> >             ^
> 
> Could you post the output of:
> 
> $ xxd < test.swift
> 
> since it looks like mail has mangled the emoji and I'm not seeing it
> in your message.
> 
> Dmitri
> 
> --
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com <mailto:gribozavr at gmail.com>>*/
> 
> 
> 
> -- 
> -Bee-
> 
>  _______________________________________________
> swift-users mailing list
> swift-users at swift.org <mailto:swift-users at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users <https://lists.swift.org/mailman/listinfo/swift-users>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20151204/70b0d1d8/attachment-0001.html>


More information about the swift-users mailing list